Skip to content

Commit 4c98f8d

Browse files
authored
golangci-lint: upgrade to v2 schema (#307)
1 parent 479646b commit 4c98f8d

File tree

2 files changed

+76
-84
lines changed

2 files changed

+76
-84
lines changed

.github/workflows/pre-main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ jobs:
3333
run: make build-oct
3434

3535
- name: Golangci-lint
36-
uses: golangci/golangci-lint-action@v6
36+
uses: golangci/golangci-lint-action@v7
3737
with:
38-
version: v1.64
3938
args: --timeout 10m0s
4039

4140
- name: make vet

.golangci.yml

Lines changed: 75 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,99 @@
1-
linters-settings:
2-
dupl:
3-
threshold: 100
4-
funlen:
5-
lines: 60
6-
statements: 45
7-
goconst:
8-
min-len: 4
9-
min-occurrences: 2
10-
gocritic:
11-
enabled-tags:
12-
- diagnostic
13-
- experimental
14-
- opinionated
15-
- performance
16-
- style
17-
disabled-checks:
18-
- whyNoLint
19-
gocyclo:
20-
min-complexity: 20
21-
goimports:
22-
local-prefixes: github.com/golangci/golangci-lint
23-
govet:
24-
settings:
25-
printf:
26-
funcs:
27-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
28-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
29-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
30-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
31-
lll:
32-
line-length: 250
33-
nolintlint:
34-
allow-unused: false # report any unused nolint directives
35-
require-explanation: false # do not require an explanation for nolint directives
36-
require-specific: true # require nolint directives to be specific about which linter is being skipped
1+
version: "2"
372
linters:
38-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
39-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
40-
disable-all: true
3+
default: none
414
enable:
425
- bodyclose
6+
- copyloopvar
437
- dogsled
448
- errcheck
459
- exhaustive
46-
- copyloopvar
4710
- funlen
4811
- goconst
4912
- gocritic
5013
- gocyclo
51-
- gofmt
52-
- goimports
53-
- mnd
5414
- goprintffuncname
5515
- gosec
56-
- gosimple
5716
- govet
5817
- ineffassign
5918
- lll
6019
- misspell
20+
- mnd
6121
- nolintlint
6222
- revive
6323
- rowserrcheck
6424
- staticcheck
65-
- stylecheck
66-
- typecheck
6725
- unconvert
6826
- unparam
6927
- unused
7028
- whitespace
71-
# do not enable:
72-
# - asciicheck
73-
# - depguard
74-
# - dupl
75-
# - gochecknoglobals
76-
# - gochecknoinits
77-
# - gocognit
78-
# - godot
79-
# - godox
80-
# - goerr113
81-
# - nakedret
82-
# - nestif
83-
# - noctx
84-
# - prealloc
85-
# - copyloopvar
86-
# - structcheck
87-
# - testpackage
88-
# - wsl
89-
issues:
90-
# Excluding configuration per-path, per-linter, per-text and per-source
91-
exclude-rules:
92-
# Ignore magic numbers, inline strings and function length in tests.
93-
- path: _test\.go
94-
linters:
95-
- mnd
96-
- goconst
97-
- funlen
98-
# Ignore line length for string assignments (do not try and wrap regex definitions)
99-
- linters:
100-
- lll
101-
source: "^(.*= (\".*\"|`.*`))$"
102-
# https://github.com/go-critic/go-critic/issues/926
103-
- linters:
104-
- gocritic
105-
text: "unnecessaryDefer:"
106-
# Ignore static strings in tests
29+
settings:
30+
dupl:
31+
threshold: 100
32+
funlen:
33+
lines: 60
34+
statements: 45
35+
goconst:
36+
min-len: 4
37+
min-occurrences: 2
38+
gocritic:
39+
disabled-checks:
40+
- whyNoLint
41+
enabled-tags:
42+
- diagnostic
43+
- experimental
44+
- opinionated
45+
- performance
46+
- style
47+
gocyclo:
48+
min-complexity: 20
49+
govet:
50+
settings:
51+
printf:
52+
funcs:
53+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
54+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
55+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
56+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
57+
lll:
58+
line-length: 250
59+
nolintlint:
60+
require-explanation: false
61+
require-specific: true
62+
allow-unused: false
63+
exclusions:
64+
generated: lax
65+
presets:
66+
- comments
67+
- common-false-positives
68+
- legacy
69+
- std-error-handling
70+
rules:
71+
- linters:
72+
- funlen
73+
- goconst
74+
- mnd
75+
path: _test\.go
76+
- linters:
77+
- lll
78+
source: ^(.*= (".*"|`.*`))$
79+
- linters:
80+
- gocritic
81+
text: 'unnecessaryDefer:'
82+
paths:
83+
- third_party$
84+
- builtin$
85+
- examples$
86+
formatters:
87+
enable:
88+
- gofmt
89+
- goimports
90+
settings:
91+
goimports:
92+
local-prefixes:
93+
- github.com/golangci/golangci-lint
94+
exclusions:
95+
generated: lax
96+
paths:
97+
- third_party$
98+
- builtin$
99+
- examples$

0 commit comments

Comments
 (0)