Skip to content

Commit 34bc306

Browse files
committed
chore: update CI and configuration
1 parent ee3af9f commit 34bc306

File tree

2 files changed

+68
-64
lines changed

2 files changed

+68
-64
lines changed

.github/workflows/pr.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ jobs:
4141
# - 1.18beta1 -> 1.18.0-beta.1
4242
# - 1.18rc1 -> 1.18.0-rc.1
4343
go-version: ${{ env.GO_VERSION }}
44-
- name: lint
45-
uses: golangci/[email protected]
46-
with:
47-
version: latest
44+
# TODO(ldez): must add uncommented when [email protected] (with golangci-lint v2 support) will be created.
45+
# - name: lint
46+
# uses: golangci/[email protected]
47+
# with:
48+
# version: latest
4849

4950
tests-on-windows:
50-
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
51+
needs: golangci-lint
5152
runs-on: windows-latest
5253
steps:
5354
- uses: actions/checkout@v4
@@ -58,7 +59,7 @@ jobs:
5859
run: make.exe test
5960

6061
tests-on-macos:
61-
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
62+
needs: golangci-lint
6263
runs-on: macos-latest
6364
steps:
6465
- uses: actions/checkout@v4
@@ -69,7 +70,7 @@ jobs:
6970
run: make test
7071

7172
tests-on-unix:
72-
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
73+
needs: golangci-lint
7374
strategy:
7475
matrix:
7576
os:
@@ -147,7 +148,8 @@ jobs:
147148

148149
- run: ./golangci-lint config
149150
- run: ./golangci-lint config path
150-
- run: ./golangci-lint config verify --schema jsonschema/golangci.jsonschema.json
151+
# TODO(ldez) after v2: golangci.next.jsonschema.json -> golangci.jsonschema.json
152+
- run: ./golangci-lint config verify --schema jsonschema/golangci.next.jsonschema.json
151153

152154
- run: ./golangci-lint help
153155
- run: ./golangci-lint help linters

.golangci.yml

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#
1212
# See the file `.golangci.reference.yml` to have a list of all available configuration options.
1313

14+
version: "2"
15+
1416
linters:
1517
disable-all: true
1618
# This list of linters is not a recommendation (same thing for all this configuration file).
@@ -31,8 +33,6 @@ linters:
3133
- gocritic
3234
- gocyclo
3335
- godox
34-
- gofmt
35-
- goimports
3636
- mnd
3737
- goprintffuncname
3838
- gosec
@@ -53,7 +53,63 @@ linters:
5353
- unparam
5454
- unused
5555
- whitespace
56+
exclusions:
57+
paths:
58+
- test/testdata_etc # test files
59+
- internal/go # extracted from Go code
60+
- internal/x # extracted from x/tools code
61+
- pkg/goformatters/gci/internal # extracted from gci code
62+
- pkg/goanalysis/runner_checker.go # extracted from x/tools code
63+
rules:
64+
- path: (.+)_test\.go
65+
linters:
66+
- dupl
67+
- mnd
68+
- lll
69+
70+
# Deprecated linter options.
71+
- path: pkg/golinters/errcheck/errcheck.go
72+
linters: [staticcheck]
73+
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
74+
- path: pkg/golinters/errcheck/errcheck.go
75+
linters: [staticcheck]
76+
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
77+
- path: pkg/golinters/govet/govet.go
78+
linters: [staticcheck]
79+
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."
80+
- path: pkg/golinters/godot/godot.go
81+
linters: [staticcheck]
82+
text: "SA1019: settings.CheckAll is deprecated: use Scope instead"
83+
- path: pkg/goformatters/gci/gci.go
84+
linters: [staticcheck]
85+
text: "SA1019: settings.LocalPrefixes is deprecated: use Sections instead."
5686

87+
# Related to `run.go`, it cannot be removed.
88+
- path: pkg/golinters/gofumpt/gofumpt.go
89+
linters: [staticcheck]
90+
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
91+
92+
# Based on existing code, the modifications should be limited to make maintenance easier.
93+
- path: pkg/golinters/unused/unused.go
94+
linters: [gocritic]
95+
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
96+
97+
# Related to the result of computation but divided multiple times by 1024.
98+
- path: test/bench/bench_test.go
99+
linters: [gosec]
100+
text: "G115: integer overflow conversion uint64 -> int"
101+
102+
formatters:
103+
enable:
104+
- gofmt
105+
- goimports
106+
settings:
107+
gofmt:
108+
rewrite-rules:
109+
- pattern: 'interface{}'
110+
replacement: 'any'
111+
goimports:
112+
local-prefixes: github.com/golangci/golangci-lint
57113

58114
linters-settings:
59115
depguard:
@@ -95,12 +151,6 @@ linters-settings:
95151
godox:
96152
keywords:
97153
- FIXME
98-
gofmt:
99-
rewrite-rules:
100-
- pattern: 'interface{}'
101-
replacement: 'any'
102-
goimports:
103-
local-prefixes: github.com/golangci/golangci-lint
104154
mnd:
105155
# don't include the "operation" and "assign"
106156
checks:
@@ -146,53 +196,5 @@ linters-settings:
146196
- name: unused-parameter
147197
- name: unused-receiver
148198

149-
issues:
150-
exclude-rules:
151-
- path: (.+)_test\.go
152-
linters:
153-
- dupl
154-
- mnd
155-
- lll
156-
157-
# Deprecated linter options.
158-
- path: pkg/golinters/errcheck/errcheck.go
159-
linters: [staticcheck]
160-
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
161-
- path: pkg/golinters/errcheck/errcheck.go
162-
linters: [staticcheck]
163-
text: "SA1019: errCfg.Ignore is deprecated: use ExcludeFunctions instead"
164-
- path: pkg/golinters/govet/govet.go
165-
linters: [staticcheck]
166-
text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable."
167-
- path: pkg/golinters/godot/godot.go
168-
linters: [staticcheck]
169-
text: "SA1019: settings.CheckAll is deprecated: use Scope instead"
170-
- path: pkg/goformatters/gci/gci.go
171-
linters: [staticcheck]
172-
text: "SA1019: settings.LocalPrefixes is deprecated: use Sections instead."
173-
174-
# Related to `run.go`, it cannot be removed.
175-
- path: pkg/golinters/gofumpt/gofumpt.go
176-
linters: [staticcheck]
177-
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
178-
179-
# Based on existing code, the modifications should be limited to make maintenance easier.
180-
- path: pkg/golinters/unused/unused.go
181-
linters: [gocritic]
182-
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
183-
184-
# Related to the result of computation but divided multiple times by 1024.
185-
- path: test/bench/bench_test.go
186-
linters: [gosec]
187-
text: "G115: integer overflow conversion uint64 -> int"
188-
189-
exclude-dirs:
190-
- test/testdata_etc # test files
191-
- internal/go # extracted from Go code
192-
- internal/x # extracted from x/tools code
193-
- pkg/goformatters/gci/internal # extracted from gci code
194-
exclude-files:
195-
- pkg/goanalysis/runner_checker.go # extracted from x/tools code
196-
197199
run:
198200
timeout: 5m

0 commit comments

Comments
 (0)