Skip to content

Commit 8c9327b

Browse files
committed
refactor(lint): update golangci-lint to v2 and configure .golangci.yml
Signed-off-by: yxxhero <aiopsclub@163.com>
1 parent 3da4f63 commit 8c9327b

File tree

2 files changed

+50
-31
lines changed

2 files changed

+50
-31
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ jobs:
2121
fetch-depth: '0'
2222

2323
- name: Golangci lint
24-
uses: golangci/golangci-lint-action@051d91933864810ecd5e2ea2cfd98f6a5bca5347
24+
uses: golangci/golangci-lint-action@v7
2525
with:
26-
version: v1.62
27-
args: --verbose --timeout=10m
26+
version: v2.0
2827

2928
- name: Markdown lint
3029
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee

.golangci.yml

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
1+
version: "2"
12
run:
2-
deadline: 3m
33
modules-download-mode: readonly
4-
5-
linters-settings:
6-
gocyclo:
7-
min-complexity: 100
8-
gci:
9-
sections:
10-
- standard
11-
- default
12-
- prefix(d7y.io/api)
13-
- prefix(d7y.io/dragonfly/v2)
14-
15-
issues:
16-
new: true
17-
exclude-rules:
18-
- linters:
19-
- staticcheck
20-
text: "SA1019:"
21-
224
linters:
23-
disable-all: true
5+
default: none
246
enable:
25-
- gci
26-
- gofmt
27-
- misspell
28-
- govet
7+
- errcheck
298
- goconst
309
- gocyclo
10+
- govet
11+
- misspell
3112
- staticcheck
32-
- errcheck
13+
settings:
14+
gocyclo:
15+
min-complexity: 100
16+
exclusions:
17+
generated: lax
18+
presets:
19+
- comments
20+
- common-false-positives
21+
- legacy
22+
- std-error-handling
23+
rules:
24+
- linters:
25+
- staticcheck
26+
text: 'SA1019:'
27+
paths:
28+
- third_party$
29+
- builtin$
30+
- examples$
31+
issues:
32+
new: true
33+
formatters:
34+
enable:
35+
- gci
36+
- gofmt
37+
settings:
38+
gci:
39+
sections:
40+
- standard
41+
- default
42+
- prefix(d7y.io/api)
43+
- prefix(d7y.io/dragonfly/v2)
44+
exclusions:
45+
generated: lax
46+
paths:
47+
- third_party$
48+
- builtin$
49+
- examples$
3350

3451
output:
35-
format: colored-line-number
36-
print-issued-lines: true
37-
print-linter-name: true
52+
formats:
53+
text:
54+
path: stdout
55+
print-linter-name: true
56+
print-issued-lines: true
57+
colors: true

0 commit comments

Comments
 (0)