Skip to content

Commit 45c5f6f

Browse files
committed
feat: upgrade golangci-lint to v2
Use the latest version of `golangci-lint` and fix the CI workflow.
1 parent 5634add commit 45c5f6f

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
go mod verify
2525
go mod download
2626
27-
LINT_VERSION=1.64.8
27+
LINT_VERSION=2.1.6
2828
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
2929
tar xz --strip-components 1 --wildcards \*/golangci-lint
3030
mkdir -p bin && mv golangci-lint bin/
@@ -45,6 +45,6 @@ jobs:
4545
assert-nothing-changed go fmt ./...
4646
assert-nothing-changed go mod tidy
4747
48-
bin/golangci-lint run --out-format=colored-line-number --timeout=3m || STATUS=$?
48+
bin/golangci-lint run --timeout=3m || STATUS=$?
4949
5050
exit $STATUS

.golangci.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# https://golangci-lint.run/usage/configuration
2+
version: "2"
3+
14
run:
25
timeout: 5m
36
tests: true
@@ -8,21 +11,25 @@ linters:
811
- govet
912
- errcheck
1013
- staticcheck
11-
- gofmt
12-
- goimports
1314
- revive
1415
- ineffassign
15-
- typecheck
1616
- unused
17-
- gosimple
1817
- misspell
1918
- nakedret
2019
- bodyclose
2120
- gocritic
2221
- makezero
2322
- gosec
2423

24+
formatters:
25+
enable:
26+
- gci
27+
- gofmt
28+
- goimports
29+
- golines
30+
2531
output:
26-
formats: colored-line-number
27-
print-issued-lines: true
28-
print-linter-name: true
32+
formats:
33+
text:
34+
print-linter-name: true
35+
print-issued-lines: true

0 commit comments

Comments
 (0)