Skip to content

Commit 7e5d505

Browse files
authored
Merge pull request #190 from hieblmi/bump-linter
linter: upgrade `golangci-lint` to v2
2 parents 666de67 + 536bc0d commit 7e5d505

File tree

11 files changed

+384
-338
lines changed

11 files changed

+384
-338
lines changed

.golangci.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
version: "2"
12
run:
2-
# timeout for analysis
3-
timeout: 4m
4-
53
# Linting uses a lot of memory. Keep it under control by only running a single
64
# worker.
75
concurrency: 1
8-
9-
linters-settings:
10-
gofmt:
11-
# simplify code: gofmt with `-s` option, true by default
12-
simplify: true
13-
146
linters:
157

168
# Specify an enabled list of linters rather than a disabled list because
@@ -19,27 +11,41 @@ linters:
1911
- bodyclose
2012
- copyloopvar
2113
- dupl
22-
- errcheck
2314
- goconst
2415
- gocritic
2516
- gocyclo
26-
- gofmt
27-
- goimports
28-
- gosimple
29-
- govet
30-
- ineffassign
3117
- misspell
3218
- nakedret
3319
- prealloc
3420
- staticcheck
35-
- stylecheck
36-
- typecheck
3721
- unconvert
3822
- unparam
39-
- unused
40-
41-
issues:
42-
exclude-rules:
43-
- path: internal/test
44-
linters:
45-
- goconst
23+
exclusions:
24+
generated: lax
25+
presets:
26+
- comments
27+
- common-false-positives
28+
- legacy
29+
- std-error-handling
30+
rules:
31+
- linters:
32+
- goconst
33+
path: internal/test
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$
38+
formatters:
39+
enable:
40+
- gofmt
41+
- goimports
42+
settings:
43+
gofmt:
44+
# simplify code: gofmt with `-s` option, true by default
45+
simplify: true
46+
exclusions:
47+
generated: lax
48+
paths:
49+
- third_party$
50+
- builtin$
51+
- examples$

aperturedb/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (t *TransactionExecutor[Q]) ExecTx(ctx context.Context,
165165

166166
for i := 0; i < t.opts.numRetries; i++ {
167167
// Create the db transaction.
168-
tx, err := t.BatchedQuerier.BeginTx(ctx, txOptions)
168+
tx, err := t.BeginTx(ctx, txOptions)
169169
if err != nil {
170170
return err
171171
}

aperturedb/sqlite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func NewTestSqliteDB(t *testing.T) *SqliteStore {
167167
require.NoError(t, err)
168168

169169
t.Cleanup(func() {
170-
require.NoError(t, sqlDB.DB.Close())
170+
require.NoError(t, sqlDB.Close())
171171
})
172172

173173
return sqlDB

challenger/lnd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ func (l *LndChallenger) VerifyInvoiceStatus(hash lntypes.Hash,
366366
// Block here until our condition is met or the allowed time is
367367
// up. The Wait() will return whenever a signal is broadcast.
368368
invoiceState, hasInvoice = l.invoiceStates[hash]
369+
//nolint:staticcheck
369370
for !(hasInvoice && invoiceState == state) && !timeoutReached {
370371
l.invoicesCond.Wait()
371372

internal/test/lnd_services_mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ func NewMockLnd() *LndMockServices {
8181
// Also simulate the cached info that is loaded on startup.
8282
info, _ := lightningClient.GetInfo(context.Background())
8383
version, _ := versioner.GetVersion(context.Background())
84-
lnd.LndServices.NodeAlias = info.Alias
84+
lnd.NodeAlias = info.Alias
8585
lnd.LndServices.NodePubkey = info.IdentityPubkey
86-
lnd.LndServices.Version = version
86+
lnd.Version = version
8787

8888
lnd.WaitForFinished = func() {
8989
chainNotifier.WaitForFinished()

onion_store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func newOnionStore(client *clientv3.Client) *onionStore {
3838

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

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

5959
// DeletePrivateKey securely removes the private key from the store.
6060
func (s *onionStore) DeletePrivateKey() error {
61-
_, err := s.Client.Delete(context.Background(), onionPath)
61+
_, err := s.Delete(context.Background(), onionPath)
6262
return err
6363
}

proxy/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ func prepareServices(services []*Service) error {
200200

201201
// There are two supported formats to encode the file
202202
// content in: hex and base64.
203-
switch {
204-
case prefix == filePrefixHex:
203+
switch prefix {
204+
case filePrefixHex:
205205
newValue := hex.EncodeToString(bytes)
206206
service.Headers[key] = newValue
207207

208-
case prefix == filePrefixBase64:
208+
case filePrefixBase64:
209209
newValue := base64.StdEncoding.EncodeToString(
210210
bytes,
211211
)

tools/Dockerfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
FROM golang:1.24.6-bookworm
1+
FROM golang:1.24.6
22

3-
RUN apt-get update && apt-get install -y git
4-
ENV GOCACHE=/tmp/build/.cache
5-
ENV GOMODCACHE=/tmp/build/.modcache
6-
ENV GOFLAGS="-buildvcs=false"
3+
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
4+
&& rm -rf /var/lib/apt/lists/*
5+
6+
ENV CGO_ENABLED=0 \
7+
GOCACHE=/tmp/build/.cache \
8+
GOMODCACHE=/tmp/build/.modcache \
9+
GOFLAGS="-buildvcs=false"
710

811
COPY . /tmp/tools
912

10-
RUN cd /tmp \
11-
&& mkdir -p /tmp/build/.cache \
12-
&& mkdir -p /tmp/build/.modcache \
13-
&& cd /tmp/tools \
14-
&& go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint \
15-
&& chmod -R 777 /tmp/build/
13+
RUN mkdir -p /tmp/build/.cache /tmp/build/.modcache \
14+
&& cd /tmp/tools \
15+
&& go install -trimpath github.com/golangci/golangci-lint/v2/cmd/golangci-lint \
16+
&& chmod -R 777 /tmp/build/
1617

17-
WORKDIR /build
18+
WORKDIR /build

0 commit comments

Comments
 (0)