Skip to content

Commit d0cd6b3

Browse files
authored
chore: upgrade to golangci-lint v2 (#305)
- Upgrades to golangci-lint configuration to support v2. - Adds golangci-line workflow with v7 that supports v2. Signed-off-by: Ryan Johnson <[email protected]>
1 parent 56aa7bf commit d0cd6b3

File tree

2 files changed

+101
-16
lines changed

2 files changed

+101
-16
lines changed

Diff for: .github/workflows/golangci-lint.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: golangci-lint
3+
4+
on:
5+
pull_request:
6+
paths-ignore:
7+
- README.md
8+
push:
9+
paths-ignore:
10+
- README.md
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- name: Setup Go
24+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
25+
with:
26+
go-version-file: go.mod
27+
cache: true
28+
- run: go mod download
29+
- run: go build -v .
30+
- name: Run Linters
31+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
32+
with:
33+
version: latest

Diff for: .golangci.yml

+68-16
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,78 @@
1-
# Visit https://golangci-lint.run/ for usage documentation
2-
# and information on other useful linters
3-
issues:
4-
max-per-linter: 0
5-
max-same-issues: 0
1+
---
2+
version: "2"
63

74
linters:
8-
disable-all: true
5+
default: none
96
enable:
10-
- copyloopvar
11-
- durationcheck
127
- errcheck
13-
- godot
14-
- gofmt
15-
- gosimple
8+
- gosec
169
- govet
1710
- ineffassign
18-
- makezero
1911
- misspell
20-
- nilerr
21-
- predeclared
12+
- revive
2213
- staticcheck
23-
- tenv
2414
- unconvert
25-
- unparam
2615
- unused
16+
exclusions:
17+
generated: lax
18+
presets:
19+
- comments
20+
- common-false-positives
21+
- legacy
22+
- std-error-handling
23+
rules:
24+
# TODO: Setting temporary exclusions.
25+
- linters:
26+
- gosec
27+
text: G101
28+
- linters:
29+
- gosec
30+
text: G115
31+
- linters:
32+
- gosec
33+
text: G401
34+
- linters:
35+
- gosec
36+
text: G402
37+
- linters:
38+
- gosec
39+
text: G501
40+
- linters:
41+
- staticcheck
42+
text: QF1003
43+
- linters:
44+
- staticcheck
45+
text: ST1019
46+
- linters:
47+
- revive
48+
text: indent-error-flow
49+
- linters:
50+
- revive
51+
text: should be
52+
- linters:
53+
- revive
54+
text: unused-parameter
55+
- linters:
56+
- revive
57+
text: var-declaration
58+
- linters:
59+
- revive
60+
text: var-naming
61+
paths:
62+
- third_party$
63+
- builtin$
64+
- examples$
65+
66+
issues:
67+
max-same-issues: 0
68+
69+
formatters:
70+
enable:
71+
- gofmt
72+
- goimports
73+
exclusions:
74+
generated: lax
75+
paths:
76+
- third_party$
77+
- builtin$
78+
- examples$

0 commit comments

Comments
 (0)