Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
version: "2"
run:
# timeout for analysis
timeout: 4m

# Linting uses a lot of memory. Keep it under control by only running a single
# worker.
concurrency: 1

linters-settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true

linters:

# Specify an enabled list of linters rather than a disabled list because
Expand All @@ -19,27 +11,41 @@ linters:
- bodyclose
- copyloopvar
- dupl
- errcheck
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused

issues:
exclude-rules:
- path: internal/test
linters:
- goconst
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- goconst
path: internal/test
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion aperturedb/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (t *TransactionExecutor[Q]) ExecTx(ctx context.Context,

for i := 0; i < t.opts.numRetries; i++ {
// Create the db transaction.
tx, err := t.BatchedQuerier.BeginTx(ctx, txOptions)
tx, err := t.BeginTx(ctx, txOptions)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion aperturedb/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func NewTestSqliteDB(t *testing.T) *SqliteStore {
require.NoError(t, err)

t.Cleanup(func() {
require.NoError(t, sqlDB.DB.Close())
require.NoError(t, sqlDB.Close())
})

return sqlDB
Expand Down
1 change: 1 addition & 0 deletions challenger/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ func (l *LndChallenger) VerifyInvoiceStatus(hash lntypes.Hash,
// Block here until our condition is met or the allowed time is
// up. The Wait() will return whenever a signal is broadcast.
invoiceState, hasInvoice = l.invoiceStates[hash]
//nolint:staticcheck
for !(hasInvoice && invoiceState == state) && !timeoutReached {
l.invoicesCond.Wait()

Expand Down
4 changes: 2 additions & 2 deletions internal/test/lnd_services_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ func NewMockLnd() *LndMockServices {
// Also simulate the cached info that is loaded on startup.
info, _ := lightningClient.GetInfo(context.Background())
version, _ := versioner.GetVersion(context.Background())
lnd.LndServices.NodeAlias = info.Alias
lnd.NodeAlias = info.Alias
lnd.LndServices.NodePubkey = info.IdentityPubkey
lnd.LndServices.Version = version
lnd.Version = version

lnd.WaitForFinished = func() {
chainNotifier.WaitForFinished()
Expand Down
4 changes: 2 additions & 2 deletions onion_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newOnionStore(client *clientv3.Client) *onionStore {

// StorePrivateKey stores the given private key.
func (s *onionStore) StorePrivateKey(privateKey []byte) error {
_, err := s.Client.Put(context.Background(), onionPath, string(privateKey))
_, err := s.Put(context.Background(), onionPath, string(privateKey))
return err
}

Expand All @@ -58,6 +58,6 @@ func (s *onionStore) PrivateKey() ([]byte, error) {

// DeletePrivateKey securely removes the private key from the store.
func (s *onionStore) DeletePrivateKey() error {
_, err := s.Client.Delete(context.Background(), onionPath)
_, err := s.Delete(context.Background(), onionPath)
return err
}
6 changes: 3 additions & 3 deletions proxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ func prepareServices(services []*Service) error {

// There are two supported formats to encode the file
// content in: hex and base64.
switch {
case prefix == filePrefixHex:
switch prefix {
case filePrefixHex:
newValue := hex.EncodeToString(bytes)
service.Headers[key] = newValue

case prefix == filePrefixBase64:
case filePrefixBase64:
newValue := base64.StdEncoding.EncodeToString(
bytes,
)
Expand Down
25 changes: 13 additions & 12 deletions tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
FROM golang:1.24.6-bookworm
FROM golang:1.24.6

RUN apt-get update && apt-get install -y git
ENV GOCACHE=/tmp/build/.cache
ENV GOMODCACHE=/tmp/build/.modcache
ENV GOFLAGS="-buildvcs=false"
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*

ENV CGO_ENABLED=0 \
GOCACHE=/tmp/build/.cache \
GOMODCACHE=/tmp/build/.modcache \
GOFLAGS="-buildvcs=false"

COPY . /tmp/tools

RUN cd /tmp \
&& mkdir -p /tmp/build/.cache \
&& mkdir -p /tmp/build/.modcache \
&& cd /tmp/tools \
&& go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint \
&& chmod -R 777 /tmp/build/
RUN mkdir -p /tmp/build/.cache /tmp/build/.modcache \
&& cd /tmp/tools \
&& go install -trimpath github.com/golangci/golangci-lint/v2/cmd/golangci-lint \
&& chmod -R 777 /tmp/build/

WORKDIR /build
WORKDIR /build
Loading
Loading