Skip to content

Commit 97fd04f

Browse files
committed
Update configuration to move to golangci-lint v2
1 parent e9242d5 commit 97fd04f

File tree

4 files changed

+40
-21
lines changed

4 files changed

+40
-21
lines changed

.golangci.yaml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
1-
linters-settings:
2-
custom:
3-
kubeapilinter:
4-
type: "module"
5-
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
6-
settings:
7-
linters:
8-
enable:
9-
- "maxlength"
10-
- "nobools"
11-
- "nomaps"
12-
- "statussubresource"
13-
lintersConfig:
14-
conditions:
15-
isFirstField: Warn
16-
useProtobuf: Ignore
17-
usePatchStrategy: Ignore
1+
version: "2"
182
linters:
19-
disable-all: true
3+
default: none
204
enable:
215
- kubeapilinter
6+
settings:
7+
custom:
8+
kubeapilinter:
9+
type: module
10+
description: kubeapilinter is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
11+
settings:
12+
linters:
13+
enable:
14+
- maxlength
15+
- nobools
16+
- nomaps
17+
- statussubresource
18+
lintersConfig:
19+
conditions:
20+
isFirstField: Warn
21+
usePatchStrategy: Ignore
22+
useProtobuf: Ignore
23+
exclusions:
24+
generated: lax
25+
presets:
26+
- comments
27+
- common-false-positives
28+
- legacy
29+
- std-error-handling
30+
paths:
31+
- third_party$
32+
- builtin$
33+
- examples$
2234
issues:
2335
# We have a lot of existing issues.
2436
# Want to make sure that those adding new fields have an
2537
# opportunity to fix them when running the linter locally.
2638
max-issues-per-linter: 1000
39+
formatters:
40+
exclusions:
41+
generated: lax
42+
paths:
43+
- third_party$
44+
- builtin$
45+
- examples$

tools/.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: v1.64.8
1+
version: v2.1.6
22
name: golangci-kube-api-linter
33
destination: ./bin
44
plugins:

tools/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ $(OUTPUT_DIR)/go-to-protobuf: $(OUTPUT_DIR)/vendor-version
105105
go build -mod=vendor -o $(OUTPUT_DIR)/go-to-protobuf ./vendor/k8s.io/code-generator/cmd/go-to-protobuf
106106

107107
$(OUTPUT_DIR)/golangci-lint: $(OUTPUT_DIR)/vendor-version
108-
go build -mod=vendor -o $(OUTPUT_DIR)/golangci-lint ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint
108+
go build -mod=vendor -o $(OUTPUT_DIR)/golangci-lint ./vendor/github.com/golangci/golangci-lint/v2/cmd/golangci-lint
109109

110110
# The golangci-lint custom command relies on finding a module, this uses a workaround to init the go.mod in the kal directory.
111111
$(OUTPUT_DIR)/golangci-kube-api-linter: $(OUTPUT_DIR)/vendor-version $(OUTPUT_DIR)/golangci-lint

tools/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
_ "github.com/gogo/protobuf/gogoproto"
88
_ "github.com/gogo/protobuf/proto"
99
_ "github.com/gogo/protobuf/sortkeys"
10-
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
10+
_ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
1111
_ "github.com/mikefarah/yq/v4"
1212
_ "github.com/vmware-archive/yaml-patch/cmd/yaml-patch"
1313
_ "k8s.io/code-generator"

0 commit comments

Comments
 (0)