Skip to content

Commit e001264

Browse files
committed
golangci-lint 2
1 parent 92d0926 commit e001264

File tree

2 files changed

+69
-58
lines changed

2 files changed

+69
-58
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v4
2222

2323
- name: golangci-lint
24-
uses: golangci/golangci-lint-action@v4
24+
uses: golangci/golangci-lint-action@v8
2525
with:
2626
version: latest
2727

.golangci.yml

Lines changed: 68 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
# https://github.com/golangci/golangci-lint/issues/456#issuecomment-617470264
2-
issues:
3-
exclude-use-default: false
4-
exclude:
5-
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
6-
- Error return value of .((os\.)?std(out|err)\..*|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
7-
# golint: False positive when tests are defined in package 'test'
8-
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
9-
# gosec: Duplicated errcheck checks
10-
- G104
11-
# gosec: Too many issues in popular repos
12-
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
13-
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
14-
- Potential file inclusion via variable
15-
1+
version: "2"
162
linters:
173
enable:
184
- asciicheck
195
- bodyclose
6+
- copyloopvar
207
- cyclop
218
- durationcheck
9+
- err113
2210
- errorlint
23-
- exportloopref
2411
- forcetypeassert
2512
- gocognit
2613
- gocritic
27-
- goerr113
28-
- gofmt
2914
- goprintffuncname
3015
- gosec
3116
- nakedret
@@ -39,7 +24,7 @@ linters:
3924
- revive
4025
- rowserrcheck
4126
- sqlclosecheck
42-
- stylecheck
27+
- staticcheck
4328
- thelper
4429
- tparallel
4530
- unconvert
@@ -49,42 +34,68 @@ linters:
4934
- wrapcheck
5035
- wsl
5136
disable:
52-
# broken?
5337
- errname
54-
55-
linters-settings:
56-
gocognit:
57-
min-complexity: 15
58-
nakedret:
59-
max-func-lines: 0
60-
nolintlint:
61-
allow-unused: false
62-
allow-leading-space: false
63-
require-explanation: true
64-
require-specific: true
65-
unused:
66-
go: '1.24'
67-
varnamelen:
68-
check-return: true
69-
ignore-type-assert-ok: true
70-
ignore-map-index-ok: true
71-
ignore-chan-recv-ok: true
72-
ignore-decls:
73-
- is *is.I
74-
- t testing.T
75-
wrapcheck:
76-
ignoreSigs:
77-
- .Errorf(
78-
- errors.New(
79-
- errors.Unwrap(
80-
- .Wrap(
81-
- .Wrapf(
82-
- .WithMessage(
83-
- .WithMessagef(
84-
- .WithStack(
85-
- .Err()
86-
ignorePackageGlobs:
87-
- github.com/blizzy78/consistent*
88-
- golang.org/x/sync/errgroup*
89-
- github.com/hashicorp/go-multierror*
90-
- github.com/magefile/mage*
38+
settings:
39+
gocognit:
40+
min-complexity: 15
41+
nakedret:
42+
max-func-lines: 0
43+
nolintlint:
44+
require-explanation: true
45+
require-specific: true
46+
allow-unused: false
47+
varnamelen:
48+
check-return: true
49+
ignore-type-assert-ok: true
50+
ignore-map-index-ok: true
51+
ignore-chan-recv-ok: true
52+
ignore-decls:
53+
- is *is.I
54+
- t testing.T
55+
wrapcheck:
56+
ignore-sigs:
57+
- .Errorf(
58+
- errors.New(
59+
- errors.Unwrap(
60+
- .Wrap(
61+
- .Wrapf(
62+
- .WithMessage(
63+
- .WithMessagef(
64+
- .WithStack(
65+
- .Err()
66+
ignore-package-globs:
67+
- github.com/blizzy78/consistent*
68+
- golang.org/x/sync/errgroup*
69+
- github.com/hashicorp/go-multierror*
70+
- github.com/magefile/mage*
71+
exclusions:
72+
generated: lax
73+
rules:
74+
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
75+
- path: (.+)\.go$
76+
text: Error return value of .((os\.)?std(out|err)\..*|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
77+
# golint: False positive when tests are defined in package 'test'
78+
- path: (.+)\.go$
79+
text: func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
80+
# gosec: Duplicated errcheck checks
81+
- path: (.+)\.go$
82+
text: G104
83+
# gosec: Too many issues in popular repos
84+
- path: (.+)\.go$
85+
text: (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
86+
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
87+
- path: (.+)\.go$
88+
text: Potential file inclusion via variable
89+
paths:
90+
- third_party$
91+
- builtin$
92+
- examples$
93+
formatters:
94+
enable:
95+
- gofmt
96+
exclusions:
97+
generated: lax
98+
paths:
99+
- third_party$
100+
- builtin$
101+
- examples$

0 commit comments

Comments
 (0)