Skip to content

Commit a17a67a

Browse files
authored
Merge pull request #1790 from jtobin/golangci-migrate-v2
tools: migrate linter config to v2
2 parents cbf1dff + 2494834 commit a17a67a

File tree

5 files changed

+392
-339
lines changed

5 files changed

+392
-339
lines changed

.golangci.yml

Lines changed: 83 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,90 @@
1-
run:
2-
# timeout for analysis
3-
timeout: 10m
4-
5-
linters-settings:
6-
errorlint:
7-
comparison: false
8-
asserts: false
9-
gofmt:
10-
# simplify code: gofmt with `-s` option, true by default
11-
simplify: true
12-
tagliatelle:
13-
case:
14-
rules:
15-
json: snake
16-
whitespace:
17-
multi-func: true
18-
multi-if: true
19-
gosec:
20-
excludes:
21-
- G402 # Look for bad TLS connection settings.
22-
- G306 # Poor file permissions used when writing to a new file.
23-
- G601 # Implicit memory aliasing in for loop.
24-
- G115 # Integer overflow conversion.
25-
exhaustive:
26-
default-signifies-exhaustive: true
27-
gocritic:
28-
disabled-checks:
29-
- unslice
30-
- captLocal
31-
- underef
32-
- appendAssign
33-
- exitAfterDefer
34-
staticcheck:
35-
checks: ['-SA1019']
36-
lll:
37-
# Max line length, lines longer will be reported.
38-
line-length: 80
39-
# Tab width in spaces.
40-
tab-width: 8
41-
1+
version: "2"
422
linters:
433
enable:
444
- errorlint
45-
- gofmt
46-
- govet
47-
- staticcheck
48-
- tagliatelle
49-
- whitespace
50-
- gosec
51-
- unused
52-
- gocritic
53-
- unconvert
54-
- nilerr
555
- exhaustive
6+
- gocritic
7+
- gosec
568
- lll
57-
9+
- nilerr
10+
- tagliatelle
11+
- unconvert
12+
- whitespace
13+
settings:
14+
errorlint:
15+
asserts: false
16+
comparison: false
17+
exhaustive:
18+
default-signifies-exhaustive: true
19+
gocritic:
20+
disabled-checks:
21+
- unslice
22+
- captLocal
23+
- underef
24+
- appendAssign
25+
- exitAfterDefer
26+
gosec:
27+
excludes:
28+
- G402 # Look for bad TLS connection settings
29+
- G306 # Poor file permissions used when writing to a new file.
30+
- G601 # Implicit memory aliasing in for loop.
31+
- G115 # Integer overflow conversion.
32+
lll:
33+
# Max line length, lines longer will be reported.
34+
line-length: 80
35+
# Tab width in spaces.
36+
tab-width: 8
37+
staticcheck:
38+
checks:
39+
- -SA1019
40+
tagliatelle:
41+
case:
42+
rules:
43+
json: snake
44+
whitespace:
45+
multi-if: true
46+
multi-func: true
47+
exclusions:
48+
generated: lax
49+
presets:
50+
- comments
51+
- common-false-positives
52+
- legacy
53+
- std-error-handling
54+
rules:
55+
# Exclude gosec from running for tests so that tests with weak randomness
56+
# (math/rand) will pass the linter.
57+
- linters:
58+
- gosec
59+
path: _test\.go
60+
- linters:
61+
- gosec
62+
path: mock.go
63+
- linters:
64+
- gosec
65+
path: internal/test/.*
66+
# Fix false positives because of build flags in itest directory.
67+
- linters:
68+
- deadcode
69+
- unused
70+
- varcheck
71+
path: itest/.*
72+
paths:
73+
- third_party$
74+
- builtin$
75+
- examples$
5876
issues:
59-
exclude-rules:
60-
# Exclude gosec from running for tests so that tests with weak randomness
61-
# (math/rand) will pass the linter.
62-
- path: _test\.go
63-
linters:
64-
- gosec
65-
- path: mock.go
66-
linters:
67-
- gosec
68-
- path: internal/test/.*
69-
linters:
70-
- gosec
71-
# Fix false positives because of build flags in itest directory.
72-
- path: itest/.*
73-
linters:
74-
- unused
75-
- deadcode
76-
- varcheck
7777
new-from-rev: 002f4ac35f343797e0a1a07a505c65a94d9dd4b3
78+
formatters:
79+
enable:
80+
- gofmt
81+
settings:
82+
gofmt:
83+
# simplify code: gofmt with `-s` option, true by default
84+
simplify: true
85+
exclusions:
86+
generated: lax
87+
paths:
88+
- third_party$
89+
- builtin$
90+
- examples$

tools/Dockerfile

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

33
RUN apt-get update && apt-get install -y git
44
ENV GOCACHE=/tmp/build/.cache
@@ -10,7 +10,7 @@ RUN cd /tmp \
1010
&& mkdir -p /tmp/build/.cache \
1111
&& mkdir -p /tmp/build/.modcache \
1212
&& cd /tmp/tools \
13-
&& go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint \
13+
&& go install -trimpath github.com/golangci/golangci-lint/v2/cmd/golangci-lint \
1414
&& chmod -R 777 /tmp/build/ \
1515
&& git config --global --add safe.directory /build
1616

0 commit comments

Comments
 (0)