Skip to content

Commit 03fa714

Browse files
committed
chore: Migrate to golangci-lint v2
1 parent b528c28 commit 03fa714

File tree

2 files changed

+34
-27
lines changed

2 files changed

+34
-27
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
E2E_SETUP_KUBECTL: yes
2222
SUDO: sudo
2323
GO_VERSION: "^1.24"
24-
GOLANGCI_LINT_VERSION: "v1.64.6"
24+
GOLANGCI_LINT_VERSION: "v2.0.2"
2525

2626
jobs:
2727
ci-go-lint:

.golangci.yml

+33-26
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
run:
2-
timeout: 10m
3-
1+
version: "2"
42
linters:
5-
disable-all: true
3+
default: none
64
enable:
75
- gocritic
86
- gocyclo
9-
- gofmt
10-
- goimports
117
- gosec
12-
- gosimple
138
- govet
149
- ineffassign
1510
- misspell
@@ -18,22 +13,34 @@ linters:
1813
- staticcheck
1914
- unconvert
2015
- unused
21-
22-
linters-settings:
23-
goimports:
24-
local-prefixes: k8s.io/kube-state-metrics,k8s.io/kube-state-metrics/v2
25-
26-
issues:
27-
exclude-use-default: false
28-
exclude-rules:
29-
# We don't check metrics naming in the tests.
30-
- path: _test\.go
31-
linters:
32-
- promlinter
33-
# TODO(mrueg) Improve error handling
34-
- text: "G104:"
35-
linters:
36-
- gosec
37-
- text: "package-comments:"
38-
linters:
39-
- revive
16+
exclusions:
17+
generated: lax
18+
rules:
19+
- linters:
20+
- promlinter
21+
path: _test\.go
22+
- linters:
23+
- gosec
24+
text: 'G104:'
25+
- linters:
26+
- revive
27+
text: 'package-comments:'
28+
paths:
29+
- third_party$
30+
- builtin$
31+
- examples$
32+
formatters:
33+
enable:
34+
- gofmt
35+
- goimports
36+
settings:
37+
goimports:
38+
local-prefixes:
39+
- k8s.io/kube-state-metrics
40+
- k8s.io/kube-state-metrics/v2
41+
exclusions:
42+
generated: lax
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$

0 commit comments

Comments
 (0)