Skip to content

Commit f858c72

Browse files
committed
bump tools/golangci-lint to v2
v2 has a fix for missing dependency github.com/tdakkota/asciicheck which break the build of v1 if GOPROXY is not used (where it is cached).
1 parent 6d515e9 commit f858c72

File tree

8 files changed

+425
-368
lines changed

8 files changed

+425
-368
lines changed

.golangci.yml

Lines changed: 109 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,122 @@
1+
version: "2"
12
run:
2-
# timeout for analysis
3-
timeout: 4m
43
go: "1.23"
4+
linters:
5+
default: all
6+
disable:
7+
# Global variables are used in many places throughout the code base.
8+
- gochecknoglobals
59

6-
linters-settings:
7-
lll:
8-
line-length: 80
9-
govet:
10-
# Don't report about shadowed variables
11-
shadow: false
12-
gofmt:
13-
# simplify code: gofmt with `-s` option, true by default
14-
simplify: true
15-
tagliatelle:
16-
case:
17-
rules:
18-
json: snake
19-
whitespace:
20-
multi-func: true
21-
multi-if: true
22-
gosec:
23-
excludes:
24-
- G402 # Look for bad TLS connection settings.
25-
- G306 # Poor file permissions used when writing to a new file.
26-
- G115 # Integer overflow conversion.
27-
staticcheck:
28-
checks: ["-SA1019"]
29-
revive:
30-
rules:
31-
- name: exported # To enforce conventions around exported comments.
10+
# We want to allow short variable names.
11+
- varnamelen
3212

33-
issues:
34-
include:
35-
- EXC0012 # revive: Exported vars should have a docstring.
36-
- EXC0014 # revive: Exported vars's docstring should start with its name.
13+
# We want to allow TODOs.
14+
- godox
3715

38-
linters:
39-
enable-all: true
40-
disable:
41-
# Global variables are used in many places throughout the code base.
42-
- gochecknoglobals
16+
# We have long functions, especially in tests. Moving or renaming those would
17+
# trigger funlen problems that we may not want to solve at that time.
18+
- funlen
4319

44-
# We want to allow short variable names.
45-
- varnamelen
20+
# Disable for now as we haven't yet tuned the sensitivity to our codebase
21+
# yet. Enabling by default for example, would also force new contributors to
22+
# potentially extensively refactor code, when they want to smaller change to
23+
# land.
24+
- gocyclo
25+
- gocognit
26+
- cyclop
4627

47-
# We want to allow TODOs.
48-
- godox
28+
# Instances of table driven tests that don't pre-allocate shouldn't trigger
29+
# the linter.
30+
- prealloc
4931

50-
# We have long functions, especially in tests. Moving or renaming those would
51-
# trigger funlen problems that we may not want to solve at that time.
52-
- funlen
32+
# Init functions are used by loggers throughout the codebase.
33+
- gochecknoinits
5334

54-
# Disable for now as we haven't yet tuned the sensitivity to our codebase
55-
# yet. Enabling by default for example, would also force new contributors to
56-
# potentially extensively refactor code, when they want to smaller change to
57-
# land.
58-
- gocyclo
59-
- gocognit
60-
- cyclop
35+
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
36+
- errorlint
6137

62-
# Instances of table driven tests that don't pre-allocate shouldn't trigger
63-
# the linter.
64-
- prealloc
38+
# Don't forbid an empty line after function signature. We add it in multi-line case.
39+
- wsl_v5
6540

66-
# Init functions are used by loggers throughout the codebase.
67-
- gochecknoinits
41+
# Don't forbid "if err := ...; err != nil" checks.
42+
- noinlineerr
6843

69-
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
70-
- errorlint
44+
# Don't demand any particular functions order.
45+
- funcorder
7146

72-
# New linters that need a code adjustment first.
73-
- wrapcheck
74-
- nolintlint
75-
- paralleltest
76-
- tparallel
77-
- testpackage
78-
- gofumpt
79-
- gomoddirectives
80-
- ireturn
81-
- maintidx
82-
- nlreturn
83-
- dogsled
84-
- gci
85-
- containedctx
86-
- contextcheck
87-
- errname
88-
- err113
89-
- mnd
90-
- noctx
91-
- nestif
92-
- wsl
93-
- exhaustive
94-
- forcetypeassert
95-
- nilerr
96-
- nilnil
97-
- stylecheck
98-
- thelper
99-
- exhaustruct
100-
- importas
101-
- interfacebloat
102-
- protogetter
103-
- depguard
104-
- mnd
105-
- perfsprint
106-
- inamedparam
47+
# New linters that need a code adjustment first.
48+
- containedctx
49+
- contextcheck
50+
- depguard
51+
- dogsled
52+
- err113
53+
- errname
54+
- exhaustive
55+
- exhaustruct
56+
- forcetypeassert
57+
- gomoddirectives
58+
- importas
59+
- inamedparam
60+
- interfacebloat
61+
- ireturn
62+
- maintidx
63+
- mnd
64+
- nestif
65+
- nilerr
66+
- nilnil
67+
- nlreturn
68+
- noctx
69+
- nolintlint
70+
- paralleltest
71+
- perfsprint
72+
- protogetter
73+
- testpackage
74+
- thelper
75+
- tparallel
76+
- wrapcheck
77+
- wsl
78+
settings:
79+
gosec:
80+
excludes:
81+
- G402 # Look for bad TLS connection settings.
82+
- G306 # Poor file permissions used when writing to a new file.
83+
- G115 # Integer overflow conversion.
84+
lll:
85+
line-length: 80
86+
revive:
87+
rules:
88+
- name: exported # To enforce conventions around exported comments.
89+
staticcheck:
90+
checks:
91+
- -SA1019
92+
tagliatelle:
93+
case:
94+
rules:
95+
json: snake
96+
whitespace:
97+
multi-if: true
98+
multi-func: true
99+
exclusions:
100+
generated: lax
101+
presets:
102+
- common-false-positives
103+
- legacy
104+
- std-error-handling
105+
paths:
106+
- third_party$
107+
- builtin$
108+
- examples$
109+
formatters:
110+
enable:
111+
- gofmt
112+
- goimports
113+
settings:
114+
gofmt:
115+
# simplify code: gofmt with `-s` option, true by default
116+
simplify: true
117+
exclusions:
118+
generated: lax
119+
paths:
120+
- third_party$
121+
- builtin$
122+
- examples$

lnd_services_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func TestLndVersionCheckComparison(t *testing.T) {
175175
type lockLNDMock struct {
176176
lnrpc.LightningClient
177177
StateClient
178+
178179
callCount int
179180
errors []error
180181
stateErr error

macaroon_service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ var (
5454
// It is also a wrapper for a macaroon.Service and uses this to create a
5555
// default macaroon for the caller if stateless mode has not been specified.
5656
type MacaroonService struct {
57-
cfg *MacaroonServiceConfig
58-
5957
*macaroons.Service
58+
59+
cfg *MacaroonServiceConfig
6060
}
6161

6262
// MacaroonServiceConfig holds configuration values used by the MacaroonService.

macaroon_service_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ func TestMacaroonGeneration(t *testing.T) {
246246

247247
type testMacaroonService struct {
248248
*macaroons.Service
249+
249250
rks bakery.RootKeyStore
250251
}
251252

@@ -284,9 +285,9 @@ func (s *testMacaroonService) stop() error {
284285
}
285286

286287
type mockSignerClient struct {
287-
sharedKey []byte
288-
289288
SignerClient
289+
290+
sharedKey []byte
290291
}
291292

292293
func (m *mockSignerClient) DeriveSharedKey(_ context.Context,

tools/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23.6-bookworm
1+
FROM golang:1.24.6-bookworm
22

33
RUN apt-get update && apt-get install -y git
44
ENV GOCACHE=/tmp/build/.cache
@@ -11,7 +11,8 @@ RUN cd /tmp \
1111
&& mkdir -p /tmp/build/.cache \
1212
&& mkdir -p /tmp/build/.modcache \
1313
&& cd /tmp/tools \
14-
&& go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint \
14+
&& go install -trimpath \
15+
github.com/golangci/golangci-lint/v2/cmd/golangci-lint \
1516
&& chmod -R 777 /tmp/build/
1617

1718
WORKDIR /build

0 commit comments

Comments
 (0)