Skip to content

Commit 02bd352

Browse files
committed
bump golangci-lint to v2
1 parent 4d32b9d commit 02bd352

File tree

8 files changed

+107
-305
lines changed

8 files changed

+107
-305
lines changed

.github/workflows/ci-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
go-version: 1.25.0
1919
- name: golangci-lint
2020
if: github.event_name == 'pull_request'
21-
uses: golangci/golangci-lint-action@v6
21+
uses: golangci/golangci-lint-action@v7
2222
with:
2323
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
24-
version: v1.64.8
24+
version: v2.4.0
2525
args: --timeout 10m
2626
go-unit-test:
2727
runs-on: ubuntu-latest

.github/workflows/ci-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
go-version: 1.25.0
1717
- name: golangci-lint
1818
if: github.event_name == 'pull_request'
19-
uses: golangci/golangci-lint-action@v6
19+
uses: golangci/golangci-lint-action@v7
2020
with:
21-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
22-
version: v1.57.2
21+
version: v2.4.0
22+
args: --timeout 10m
2323
go-unit-test:
2424
runs-on: ubuntu-latest
2525
needs: [style-check]

.golangci.yaml

Lines changed: 88 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,92 @@
1-
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
2-
#
3-
# The original version of this file is located in the https://github.com/istio/common-files repo.
4-
# If you're looking at this file in a different repo and want to make a change, please go to the
5-
# common-files repo, make the change there and check it in. Then come back to this repo and run
6-
# "make update-common".
1+
version: "2"
72
run:
83
build-tags:
9-
- integ
10-
- integfuzz
11-
12-
4+
- integ
5+
- integfuzz
136
linters:
14-
disable-all: true
7+
default: none
158
enable:
16-
- errcheck
17-
- gocritic
18-
- gofumpt
19-
- goimports
20-
- gosimple
21-
- govet
22-
- ineffassign
23-
- lll
24-
- misspell
25-
- staticcheck
26-
- stylecheck
27-
- typecheck
28-
- unconvert
29-
- unparam
30-
fast: false
31-
32-
linters-settings:
33-
errcheck:
34-
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
35-
# default is false: such cases aren't reported by default.
36-
check-type-assertions: false
37-
38-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
39-
# default is false: such cases aren't reported by default.
40-
check-blank: false
41-
goimports:
42-
# put imports beginning with prefix after 3rd-party packages;
43-
# it's a comma-separated list of prefixes
44-
local-prefixes: github.com/baizeai/kube-snapshot
45-
misspell:
46-
# Correct spellings using locale preferences for US or UK.
47-
# Default is to use a neutral variety of English.
48-
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
49-
locale: US
50-
ignore-words:
51-
- cancelled
52-
lll:
53-
# max line length, lines longer will be reported. Default is 120.
54-
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
55-
line-length: 160
56-
# tab width in spaces. Default to 1.
57-
tab-width: 1
58-
gocritic:
59-
enabled-checks:
60-
- appendCombine
61-
- boolExprSimplify
62-
- builtinShadow
63-
- commentedOutCode
64-
- commentedOutImport
65-
- docStub
66-
- emptyFallthrough
67-
- equalFold
68-
- hexLiteral
69-
- indexAlloc
70-
- initClause
71-
- methodExprCall
72-
- nilValReturn
73-
- octalLiteral
74-
- rangeExprCopy
75-
- stringXbytes
76-
- typeAssertChain
77-
- typeUnparen
78-
- unnecessaryBlock
79-
- weakCond
80-
81-
# Unused
82-
# - yodaStyleExpr
83-
# - appendAssign
84-
# - commentFormatting
85-
# - emptyStringTest
86-
# - exitAfterDefer
87-
# - ifElseChain
88-
# - hugeParam
89-
# - importShadow
90-
# - nestingReduce
91-
# - paramTypeCombine
92-
# - ptrToRefParam
93-
# - rangeValCopy
94-
# - singleCaseSwitch
95-
# - sloppyReassign
96-
# - unlabelStmt
97-
# - unnamedResult
98-
# - wrapperFunc
99-
100-
issues:
101-
# List of regexps of issue texts to exclude, empty list by default.
102-
# But independently from this option we use default exclude patterns,
103-
# it can be disabled by `exclude-use-default: false`. To list all
104-
# excluded by default patterns execute `golangci-lint run --help`
105-
exclude:
106-
- composite literal uses unkeyed fields
107-
108-
exclude-files:
109-
- ".*\\.pb\\.go"
110-
- ".*\\.gen\\.go"
111-
112-
exclude-dirs:
113-
- vendor$
114-
- genfiles$
115-
116-
exclude-rules:
117-
# Exclude some linters from running on test files.
118-
- path: _test\.go$|^tests/|^samples/
119-
linters:
120-
- errcheck
121-
122-
# TODO(https://github.com/dominikh/go-tools/issues/732) remove this once we update
123-
- linters:
124-
- staticcheck
125-
text: "SA1019: package github.com/golang/protobuf"
126-
127-
# Independently from option `exclude` we use default exclude patterns,
128-
# it can be disabled by this option. To list all
129-
# excluded by default patterns execute `golangci-lint run --help`.
130-
# Default value for this option is true.
131-
exclude-use-default: true
9+
- errcheck
10+
- gocritic
11+
- govet
12+
- ineffassign
13+
- lll
14+
- misspell
15+
- staticcheck
16+
- unconvert
17+
- unparam
18+
settings:
19+
errcheck:
20+
check-type-assertions: false
21+
check-blank: false
22+
gocritic:
23+
enabled-checks:
24+
- appendCombine
25+
- boolExprSimplify
26+
- builtinShadow
27+
- commentedOutCode
28+
- commentedOutImport
29+
- docStub
30+
- emptyFallthrough
31+
- equalFold
32+
- hexLiteral
33+
- indexAlloc
34+
- initClause
35+
- methodExprCall
36+
- nilValReturn
37+
- octalLiteral
38+
- rangeExprCopy
39+
- stringXbytes
40+
- typeAssertChain
41+
- typeUnparen
42+
- unnecessaryBlock
43+
- weakCond
44+
lll:
45+
line-length: 160
46+
tab-width: 1
47+
misspell:
48+
locale: US
49+
ignore-rules:
50+
- cancelled
51+
exclusions:
52+
generated: lax
53+
presets:
54+
- comments
55+
- common-false-positives
56+
- legacy
57+
- std-error-handling
58+
rules:
59+
- linters:
60+
- errcheck
61+
path: _test\.go$|^tests/|^samples/
62+
- linters:
63+
- staticcheck
64+
text: 'SA1019: package github.com/golang/protobuf'
65+
- path: (.+)\.go$
66+
text: composite literal uses unkeyed fields
67+
paths:
68+
- .*\.pb\.go
69+
- .*\.gen\.go
70+
- vendor$
71+
- genfiles$
72+
- third_party$
73+
- builtin$
74+
- examples$
75+
formatters:
76+
enable:
77+
- gofumpt
78+
- goimports
79+
settings:
80+
goimports:
81+
local-prefixes:
82+
- github.com/baizeai/kube-snapshot
83+
exclusions:
84+
generated: lax
85+
paths:
86+
- .*\.pb\.go
87+
- .*\.gen\.go
88+
- vendor$
89+
- genfiles$
90+
- third_party$
91+
- builtin$
92+
- examples$

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ require (
1818
k8s.io/apimachinery v0.33.4
1919
k8s.io/client-go v0.33.4
2020
k8s.io/klog/v2 v2.130.1
21-
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
2221
sigs.k8s.io/controller-runtime v0.21.0
2322
)
2423

@@ -123,7 +122,6 @@ require (
123122
github.com/spaolacci/murmur3 v1.1.0 // indirect
124123
github.com/spf13/pflag v1.0.6 // indirect
125124
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 // indirect
126-
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
127125
github.com/x448/float16 v0.8.4 // indirect
128126
go.opencensus.io v0.24.0 // indirect
129127
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
@@ -138,7 +136,6 @@ require (
138136
go.yaml.in/yaml/v2 v2.4.2 // indirect
139137
go.yaml.in/yaml/v3 v3.0.4 // indirect
140138
golang.org/x/crypto v0.41.0 // indirect
141-
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
142139
golang.org/x/net v0.43.0 // indirect
143140
golang.org/x/oauth2 v0.30.0 // indirect
144141
golang.org/x/sync v0.16.0 // indirect
@@ -155,6 +152,7 @@ require (
155152
gopkg.in/yaml.v3 v3.0.1 // indirect
156153
k8s.io/apiextensions-apiserver v0.33.4 // indirect
157154
k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a // indirect
155+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
158156
lukechampine.com/blake3 v1.4.1 // indirect
159157
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
160158
sigs.k8s.io/randfill v1.0.0 // indirect

0 commit comments

Comments
 (0)