Skip to content

Commit 8228262

Browse files
bump golangci-lint to v2 (#880)
* bump golangci-lint to v2 Signed-off-by: Tyler Auerbeck <[email protected]> * bump golangci-lint version in Signed-off-by: Tyler Auerbeck <[email protected]> * add comments to satisfy linter Signed-off-by: Tyler Auerbeck <[email protected]> --------- Signed-off-by: Tyler Auerbeck <[email protected]> Co-authored-by: Tyler Auerbeck <[email protected]>
1 parent b0e18b6 commit 8228262

File tree

4 files changed

+55
-49
lines changed

4 files changed

+55
-49
lines changed

.golangci.yml

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,67 @@
1-
# all available settings of specific linters
2-
linters-settings:
3-
gocritic:
4-
enabled-tags:
5-
- performance
6-
- diagnostic
7-
- style
8-
- experimental
9-
- opinionated
10-
disabled-checks:
11-
- hugeParam
12-
- rangeValCopy
13-
- unnamedResult
14-
gofmt:
15-
simplify: true
16-
goimports:
17-
# put imports beginning with prefix after 3rd-party packages;
18-
# it's a comma-separated list of prefixes
19-
local-prefixes: sigs.k8s.io/krew
20-
errcheck:
21-
check-type-assertions: false
22-
check-blank: false
23-
staticcheck:
24-
checks:
25-
- all
26-
- "-SA1019" # allow usage of global rand.Seed
27-
28-
29-
# options for analysis running
1+
version: "2"
302
run:
31-
# include test files
323
tests: true
33-
34-
issues:
35-
# which dirs to skip: they won't be analyzed;
36-
# can use regexp here: generated.*, regexp is applied on full path;
37-
# default value is empty list, but next dirs are always skipped independently
38-
# from this option's value:
39-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
40-
exclude-dirs:
41-
- hack
42-
- docs
43-
444
linters:
45-
disable-all: true
5+
default: none
466
enable:
477
- errcheck
488
- gocritic
49-
- gofmt
50-
- goimports
51-
- gosimple
529
- govet
5310
- ineffassign
5411
- misspell
5512
- prealloc
5613
- revive
5714
- staticcheck
58-
- stylecheck
5915
- unconvert
6016
- unparam
6117
- unused
18+
settings:
19+
errcheck:
20+
check-type-assertions: false
21+
check-blank: false
22+
gocritic:
23+
disabled-checks:
24+
- hugeParam
25+
- rangeValCopy
26+
- unnamedResult
27+
enabled-tags:
28+
- performance
29+
- diagnostic
30+
- style
31+
- experimental
32+
- opinionated
33+
staticcheck:
34+
checks:
35+
- all
36+
- -SA1019
37+
exclusions:
38+
generated: lax
39+
presets:
40+
- comments
41+
- common-false-positives
42+
- legacy
43+
- std-error-handling
44+
paths:
45+
- hack
46+
- docs
47+
- third_party$
48+
- builtin$
49+
- examples$
50+
formatters:
51+
enable:
52+
- gofmt
53+
- goimports
54+
settings:
55+
gofmt:
56+
simplify: true
57+
goimports:
58+
local-prefixes:
59+
- sigs.k8s.io/krew
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- hack
64+
- docs
65+
- third_party$
66+
- builtin$
67+
- examples$

hack/run-lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ gopath="$(go env GOPATH)"
2323
if ! [[ -x "$gopath/bin/golangci-lint" ]]; then
2424
echo >&2 'Installing golangci-lint'
2525
curl --silent --fail --location \
26-
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$gopath/bin" v1.57.2
26+
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$gopath/bin" v2.1.6
2727
fi
2828

2929
# configured by .golangci.yml

internal/receiptsmigration/migration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ func Done(newPaths environment.Paths) (bool, error) {
3636
hasInstalledPlugins := len(plugins) > 0
3737
hasNoReceipts := len(receipts) == 0
3838

39-
return !(hasInstalledPlugins && hasNoReceipts), nil
39+
return !(hasInstalledPlugins && hasNoReceipts), nil //nolint:staticcheck // de morgan's law is not necessary here
4040
}

internal/testutil/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func NewPlugin() *P {
5757
}}
5858
}
5959

60-
func (p *P) WithName(s string) *P { p.v.ObjectMeta.Name = s; return p }
60+
func (p *P) WithName(s string) *P { p.v.Name = s; return p }
6161
func (p *P) WithShortDescription(v string) *P { p.v.Spec.ShortDescription = v; return p }
6262
func (p *P) WithTypeMeta(v metav1.TypeMeta) *P { p.v.TypeMeta = v; return p }
6363
func (p *P) WithPlatforms(v ...index.Platform) *P { p.v.Spec.Platforms = v; return p }

0 commit comments

Comments
 (0)