Skip to content

Commit 05e8246

Browse files
committed
ci: update and optimize Go linting configuration and toolchain
- Update golangci-lint action version from `v6` to `v7` - Change golangci-lint configuration version to `v2.0` - Adjust Go version matrix to support only `1.23` and `1.24` - Modify linter settings to enable specific linters and adjust exclusions - Update enabled formatters to include `gofmt` and `goimports` - Remove redundant and disabled linters and settings from `.golangci.yml` Signed-off-by: appleboy <[email protected]>
1 parent 15e4eec commit 05e8246

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ jobs:
2020
go-version-file: go.mod
2121
check-latest: true
2222
- name: Setup golangci-lint
23-
uses: golangci/golangci-lint-action@v6
23+
uses: golangci/golangci-lint-action@v7
2424
with:
25-
version: latest
26-
args: --verbose
25+
version: v2.0
2726

2827
test:
2928
strategy:
3029
matrix:
3130
os: [ubuntu-latest]
32-
go: [1.21, 1.22, 1.23, 1.24]
31+
go: [1.23, 1.24]
3332
include:
3433
- os: ubuntu-latest
3534
go-build: ~/.cache/go-build

.golangci.yml

Lines changed: 23 additions & 12 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,13 +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-
38-
run:
39-
timeout: 3m
44+
- goimports
45+
exclusions:
46+
generated: lax
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$

0 commit comments

Comments
 (0)