Skip to content

Commit 83d533a

Browse files
committed
Update golangci-lint to v2 and migrate its config
This allows us to use golangci-lint with Go 1.25. Config was migrated via `golangci-lint migrate` and manually adding back the comments.
1 parent 55be8b3 commit 83d533a

File tree

5 files changed

+393
-367
lines changed

5 files changed

+393
-367
lines changed

.golangci-ci.yaml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33

44
# Please keep the list in sync with .golangci-ide.yaml. For rationale, see the other file.
55

6+
version: "2"
67
linters:
78
# linters to run in addition to default ones
89
enable:
910
- dupl
1011
- durationcheck
1112
- errname
1213
- errorlint
13-
- exportloopref
1414
- forbidigo
1515
- forcetypeassert
16-
- gci
1716
- godot
18-
- gofmt
1917
- gosec
2018
- misspell
2119
- revive
@@ -25,26 +23,32 @@ linters:
2523
- unparam
2624
- wastedassign
2725
- whitespace
28-
##- wrapcheck # To think properly about it
29-
30-
run:
31-
# Most of the time, it’s taking less than 20s, but some builders are slower, so takes 2m
32-
timeout: 2m
33-
34-
# Get all linter issues, even if duplicated
26+
settings:
27+
# Forbid the usage of deprecated ioutil and debug prints
28+
forbidigo:
29+
forbid:
30+
- pattern: ioutil\.
31+
- pattern: ^print(f|ln)?\($
32+
exclusions:
33+
generated: lax
34+
# EXC0001 errcheck: most errors are in defer calls, which are safe to ignore and idiomatic Go (would be good to only ignore defer ones though)
35+
rules:
36+
- path: (.+)\.go$
37+
text: Error return value of .*Close` is not checked
38+
paths:
39+
- third_party$
40+
- builtin$
41+
- examples$
3542
issues:
36-
exclude-use-default: false
3743
max-issues-per-linter: 0
3844
max-same-issues: 0
39-
40-
exclude:
41-
# EXC0001 errcheck: most errors are in defer calls, which are safe to ignore and idiomatic Go (would be good to only ignore defer ones though)
42-
- 'Error return value of .*Close` is not checked'
43-
#fix: true # we don’t want this in CI
44-
45-
linters-settings:
46-
# Forbid the usage of deprecated ioutil and debug prints
47-
forbidigo:
48-
forbid:
49-
- ioutil\.
50-
- ^print(f|ln)?\($
45+
formatters:
46+
enable:
47+
- gci
48+
- gofmt
49+
exclusions:
50+
generated: lax
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$

.golangci.yaml

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,48 @@
66

77
# Please keep the list in sync.
88

9+
version: "2"
910
linters:
10-
fast: true
1111
# linters to run in addition to default ones
1212
enable:
1313
- dupl
14-
#- durationcheck
15-
#- errname
16-
#- errorlint
17-
#- exportloopref
1814
- forbidigo
1915
- forcetypeassert
20-
- gci
2116
- godot
22-
- gofmt
23-
#- gosec
2417
- misspell
2518
- revive
26-
#- thelper
27-
#- tparallel
28-
#- unconvert
29-
#- unparam
30-
#- wastedassign
31-
#- whitespace
32-
##- wrapcheck # To think properly about it
33-
34-
# Get all linter issues, even if duplicated
19+
disable:
20+
- errcheck
21+
- govet
22+
- staticcheck
23+
- unused
24+
settings:
25+
# Forbid the usage of deprecated ioutil and debug prints
26+
forbidigo:
27+
forbid:
28+
- pattern: ioutil\.
29+
- pattern: ^print(f|ln)?\($
30+
exclusions:
31+
generated: lax
32+
rules:
33+
# EXC0001 errcheck: most errors are in defer calls, which are safe to ignore and idiomatic Go (would be good to only ignore defer ones though)
34+
- path: (.+)\.go$
35+
text: Error return value of .*Close` is not checked
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$
3540
issues:
36-
exclude-use-default: false
3741
max-issues-per-linter: 0
3842
max-same-issues: 0
39-
exclude:
40-
# EXC0001 errcheck: most errors are in defer calls, which are safe to ignore and idiomatic Go (would be good to only ignore defer ones though)
41-
- 'Error return value of .*Close` is not checked'
4243
fix: true # we want this in IDE.
43-
44-
linters-settings:
45-
# Forbid the usage of deprecated ioutil and debug prints
46-
forbidigo:
47-
forbid:
48-
- ioutil\.
49-
- ^print(f|ln)?\($
44+
formatters:
45+
enable:
46+
- gci
47+
- gofmt
48+
exclusions:
49+
generated: lax
50+
paths:
51+
- third_party$
52+
- builtin$
53+
- examples$

0 commit comments

Comments
 (0)