Skip to content

Commit 0318b1b

Browse files
authored
bump to golangci yaml v2 (#950)
1 parent 529f40e commit 0318b1b

File tree

1 file changed

+79
-81
lines changed

1 file changed

+79
-81
lines changed

.golangci.yaml

Lines changed: 79 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,15 @@
1+
version: "2"
12
run:
2-
timeout: 10m
3+
build-tags:
4+
- e2e
5+
- hpa
6+
- upgrade
37
allow-parallel-runners: true
4-
exclude-dirs:
5-
- client
6-
- injection/clients
7-
88
output:
9-
sort-results: true
109
sort-order:
11-
- linter
12-
- file
13-
show-stats: true
14-
15-
16-
issues:
17-
uniq-by-line: true
18-
max-issues-per-linter: 0
19-
max-same-issues: 0
20-
exclude-rules:
21-
- path: test # Excludes /test, *_test.go etc.
22-
linters:
23-
- gosec
24-
- unparam
25-
- noctx
26-
- protogetter
27-
- linters: ["gocritic"]
28-
# Fixes are non-trivial do in a follow up
29-
text: "ifElseChain"
30-
31-
linters-settings:
32-
# goimports:
33-
# local-prefixes: knative.dev/pkg
34-
gomodguard:
35-
blocked:
36-
modules:
37-
- github.com/ghodss/yaml:
38-
recommendations:
39-
- sigs.k8s.io/yaml
40-
- go.uber.org/atomic:
41-
recommendations:
42-
- sync/atomic
43-
- io/ioutil:
44-
recommendations:
45-
- os
46-
- io
47-
- github.com/hashicorp/go-multierror:
48-
reason: "use errors.Join"
49-
recommendations:
50-
- errors
51-
- go.uber.org/multierr:
52-
reason: "use errors.Join"
53-
recommendations:
54-
- errors
55-
revive:
56-
rules:
57-
# use unparam linter instead - defaults are better
58-
- name: unused-parameter
59-
disabled: true
60-
10+
- linter
11+
- file
6112
linters:
62-
disable:
63-
- errcheck
6413
enable:
6514
# Check for pass []any as any in variadic func(...any).
6615
- asasalint
@@ -81,7 +30,7 @@ linters:
8130
# # Containedctx is a linter that detects struct contained context.Context
8231
# # field.
8332
# - containedctx
84-
33+
#
8534
# TODO - do a follow up PR
8635
# # Check whether the function uses a non-inherited context.
8736
# - contextcheck
@@ -115,27 +64,12 @@ linters:
11564
# report message and optional suggestion.
11665
- gocritic
11766

118-
# Gofmt checks whether code was gofmt-ed. By default this tool runs
119-
# with -s option to check for code simplification.
120-
- gofmt
121-
122-
# Gofumpt checks whether code was gofumpt-ed.
123-
- gofumpt
124-
125-
# Check import statements are formatted according to the 'goimport'
126-
# command. Reformat imports in autofix mode.
127-
- goimports
128-
12967
# See config below
13068
- gomodguard
13169

13270
# Inspects source code for security problems.
13371
- gosec
13472

135-
# Linter that specializes in simplifying code.
136-
- gosimple
137-
- govet
138-
13973
# Intrange is a linter to find places where for loops could make use of
14074
# an integer range.
14175
- intrange
@@ -183,12 +117,7 @@ linters:
183117
# Checks for mistakes with OpenTelemetry/Census spans.
184118
- spancheck
185119

186-
# Stylecheck is a replacement for golint.
187-
- stylecheck
188-
189-
# Tenv is analyzer that detects using os.Setenv instead of t.Setenv
190-
# since Go1.17.
191-
- tenv
120+
- staticcheck
192121

193122
# Linter checks if examples are testable (have an expected output).
194123
- testableexamples
@@ -209,4 +138,73 @@ linters:
209138
# Whitespace is a linter that checks for unnecessary newlines at the start
210139
# and end of functions, if, for, etc.
211140
- whitespace
212-
141+
disable:
142+
- errcheck
143+
settings:
144+
gocritic:
145+
disabled-checks:
146+
- exitAfterDefer
147+
- appendAssign
148+
gomodguard:
149+
blocked:
150+
modules:
151+
- github.com/ghodss/yaml:
152+
recommendations:
153+
- sigs.k8s.io/yaml
154+
- go.uber.org/atomic:
155+
recommendations:
156+
- sync/atomic
157+
- io/ioutil:
158+
recommendations:
159+
- os
160+
- io
161+
- github.com/hashicorp/go-multierror:
162+
recommendations:
163+
- errors
164+
reason: use errors.Join
165+
- go.uber.org/multierr:
166+
recommendations:
167+
- errors
168+
reason: use errors.Join
169+
revive:
170+
rules:
171+
- name: unused-parameter
172+
disabled: true
173+
exclusions:
174+
generated: lax
175+
presets:
176+
- comments
177+
- common-false-positives
178+
- legacy
179+
- std-error-handling
180+
rules:
181+
- linters:
182+
- gosec
183+
- noctx
184+
- protogetter
185+
- unparam
186+
path: test
187+
- linters:
188+
- gocritic
189+
text: ifElseChain
190+
paths:
191+
- pkg/client
192+
- third_party$
193+
- builtin$
194+
- examples$
195+
issues:
196+
max-issues-per-linter: 0
197+
max-same-issues: 0
198+
uniq-by-line: true
199+
formatters:
200+
enable:
201+
- gofmt
202+
- gofumpt
203+
- goimports
204+
exclusions:
205+
generated: lax
206+
paths:
207+
- pkg/client
208+
- third_party$
209+
- builtin$
210+
- examples$

0 commit comments

Comments
 (0)