Skip to content

Commit 1ec65fe

Browse files
committed
ci: update GolangCI-lint configurations and improve linting rules
- Update golangci-lint-action version from v6 to v7 in GitHub Actions workflow - Add `version: "2"` to `.golangci.yml` configuration - Replace `enable-all: false`, `disable-all: true`, and `fast: false` with `default: none` - Remove some linters including `exportloopref`, `gofmt`, `goimports`, `gosimple`, `stylecheck`, `typecheck`, and `gofumpt` - Add new exclusion rules presets like `comments`, `common-false-positives`, `legacy`, and `std-error-handling` - Change exclusion rules syntax for specific test files and their associated linters - Add new path exclusions for `third_party`, `builtin`, and `examples` - Add new formatters including `gofmt`, `gofumpt`, and `goimports` Signed-off-by: appleboy <[email protected]>
1 parent d0d1ce7 commit 1ec65fe

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
go-version-file: "go.mod"
2222

2323
- name: Setup golangci-lint
24-
uses: golangci/golangci-lint-action@v6
24+
uses: golangci/golangci-lint-action@v7
2525
with:
2626
args: --verbose
2727
test:

.golangci.yml

Lines changed: 34 additions & 24 deletions
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,25 +22,40 @@ 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+
rules:
37+
- linters:
38+
- bodyclose
39+
- unparam
40+
path: authenticator_test.go
41+
- linters:
42+
- lll
43+
path: parser_test.go
44+
- linters:
45+
- lll
46+
path: signatureheader_test.go
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$
51+
formatters:
52+
enable:
53+
- gofmt
3654
- gofumpt
37-
38-
issues:
39-
exclude-rules:
40-
- path: authenticator_test.go
41-
linters:
42-
- bodyclose
43-
- unparam
44-
- path: parser_test.go
45-
linters:
46-
- lll
47-
- path: signatureheader_test.go
48-
linters:
49-
- lll
50-
run:
51-
timeout: 3m
55+
- goimports
56+
exclusions:
57+
generated: lax
58+
paths:
59+
- third_party$
60+
- builtin$
61+
- examples$

0 commit comments

Comments
 (0)