Skip to content

Commit aa60ac1

Browse files
committed
ci: reorganize and update golangci-lint configuration
- Update golangci-lint action to use version 7 and specify version 2.0 - Specify golangci-lint configuration version as "2" - Replace `enable-all`, `disable-all` with `default: none` in golangci configuration - Remove multiple linters from golangci configuration - Add new exclusion rules for generated code and preset exclusions - Reorganize formatter settings in golangci configuration and enable gofmt and goimports - Remove run timeout setting from golangci configuration Signed-off-by: appleboy <[email protected]>
1 parent f75942a commit aa60ac1

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

.github/workflows/go.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ jobs:
2323
go-version-file: go.mod
2424
check-latest: true
2525
- name: Setup golangci-lint
26-
uses: golangci/golangci-lint-action@v6
26+
uses: golangci/golangci-lint-action@v7
2727
with:
28+
version: v2.0
2829
args: --verbose
2930
test:
3031
strategy:

.golangci.yml

+23-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1+
version: "2"
12
linters:
2-
enable-all: false
3-
disable-all: true
4-
fast: false
3+
default: none
54
enable:
65
- bodyclose
76
- dogsled
87
- dupl
98
- errcheck
10-
- exportloopref
119
- exhaustive
1210
- gochecknoinits
1311
- goconst
1412
- gocritic
1513
- gocyclo
16-
- gofmt
17-
- goimports
1814
- goprintffuncname
1915
- gosec
20-
- gosimple
2116
- govet
2217
- ineffassign
2318
- lll
@@ -27,12 +22,29 @@ linters:
2722
- nolintlint
2823
- rowserrcheck
2924
- staticcheck
30-
- stylecheck
31-
- typecheck
3225
- unconvert
3326
- unparam
3427
- unused
3528
- whitespace
29+
exclusions:
30+
generated: lax
31+
presets:
32+
- comments
33+
- common-false-positives
34+
- legacy
35+
- std-error-handling
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$
40+
formatters:
41+
enable:
42+
- gofmt
3643
- gofumpt
37-
run:
38-
timeout: 3m
44+
- goimports
45+
exclusions:
46+
generated: lax
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$

0 commit comments

Comments
 (0)