1414 # Default: true
1515 tests : false
1616
17- # Which dirs to skip: issues from them won't be reported.
18- # Can use regexp here: `generated.*`, regexp is applied on full path.
19- # Default value is empty list,
20- # but default dirs are skipped independently of this option's value (see skip-dirs-use-default).
21- # "/" will be replaced by current OS file path separator to properly work on Windows.
22- skip-dirs :
23- - pkg/model/pb
24- - .*~
25- - test
26- - examples
27-
28- # Which files to skip: they will be analyzed, but issues from them won't be reported.
29- # Default value is empty list,
30- # but there is no need to include all autogenerated files,
31- # we confidently recognize autogenerated files.
32- # If it's not please let us know.
33- # "/" will be replaced by current OS file path separator to properly work on Windows.
34- skip-files :
35- - " .*\\ .my\\ .go$"
36- - " .*\\ .pb\\ .go$"
37- - " .*_test\\ .go$"
17+ # Timeout for analysis, e.g. 30s, 5m.
18+ # Default: 1m
19+ timeout : 30m
3820
3921# Main linters configurations.
4022# See https://golangci-lint.run/usage/linters
@@ -61,6 +43,46 @@ linters:
6143 - whitespace # Tool for detection of leading and trailing whitespace
6244
6345issues :
46+ # Report only new issues: if there are unstaged changes or untracked files,
47+ # only those changes are analyzed, else only changes in HEAD~ commit are analyzed.
48+ # It's a super-useful option for integration of golangci-lint into existing large codebase.
49+ # It's not practical to fix all existing issues at the moment of integration:
50+ # much better don't allow issues in new code.
51+ # Default: false.
52+ new : false
53+
54+ # Show only new issues created after git revision `REV`
55+ # 只检查相对于 main 分支的变更
56+ # 本地运行时会自动使用此配置
57+ # CI 中也可以通过 --new-from-rev 参数覆盖此设置
58+ new-from-rev : origin/main
59+
60+ # Maximum issues count per one linter.
61+ # Set to 0 to disable.
62+ # Default: 50
63+ max-issues-per-linter : 0
64+
65+ # Maximum count of issues with the same text.
66+ # Set to 0 to disable.
67+ # Default: 3
68+ max-same-issues : 0
69+
70+ # Which dirs to exclude: issues from them won't be reported.
71+ # Can use regexp here: `generated.*`, regexp is applied on full path.
72+ # "/" will be replaced by current OS file path separator to properly work on Windows.
73+ exclude-dirs :
74+ - pkg/model/pb
75+ - .*~
76+ - test
77+ - examples
78+
79+ # Which files to exclude: they will be analyzed, but issues from them won't be reported.
80+ # "/" will be replaced by current OS file path separator to properly work on Windows.
81+ exclude-files :
82+ - " .*\\ .my\\ .go$"
83+ - " .*\\ .pb\\ .go$"
84+ - " .*_test\\ .go$"
85+
6486 exclude-rules :
6587 # helpers in tests often (rightfully) pass a *testing.T as their first argument
6688 - path : _test\.go
@@ -222,10 +244,6 @@ linters-settings:
222244
223245 # https://golangci-lint.run/usage/linters/#gosimple
224246 gosimple :
225- # Select the Go version to target.
226- # Default: 1.13
227- # Deprecated: use the global `run.go` instead.
228- go : " 1.15"
229247 # Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
230248 # Default: ["*"]
231249 checks :
@@ -247,9 +265,6 @@ linters-settings:
247265
248266 # https://golangci-lint.run/usage/linters/#govet
249267 govet :
250- # Report about shadowed variables.
251- # Default: false
252- check-shadowing : true
253268 # Settings per analyzer.
254269 settings :
255270 # Analyzer name, run `go tool vet help` to see all analyzers.
@@ -307,7 +322,7 @@ linters-settings:
307322 - nilness
308323 - reflectvaluecompare
309324 - shift
310- - shadow
325+ # shadow 已移除,如需启用请在 linters.enable 中添加 shadow
311326 - sigchanyzer
312327 - sortslice
313328 - stdmethods
@@ -322,10 +337,6 @@ linters-settings:
322337
323338 # https://golangci-lint.run/usage/linters/#staticcheck
324339 staticcheck :
325- # Select the Go version to target.
326- # Default: "1.13"
327- # Deprecated: use the global `run.go` instead.
328- go : " 1.15"
329340 # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
330341 # Default: ["*"]
331342 checks :
0 commit comments