Skip to content

Commit e1c60c1

Browse files
authored
ci: improve/fix golangci-lint config (#4307)
1 parent 5817a7d commit e1c60c1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.golangci.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
run:
22
timeout: 5m
3-
go: '1.23.2'
43

54
linters:
65
disable-all: true
76
enable:
87
#- containedctx
98
#- contextcheck
10-
#- depguard
9+
- depguard
1110
- errcheck
1211
#- errchkjson
1312
#- errname
@@ -39,11 +38,12 @@ linters:
3938

4039
linters-settings:
4140
depguard:
42-
list-type: blacklist
43-
packages:
44-
- k8s.io/kubernetes
45-
packages-with-error-messages:
46-
k8s.io/kubernetes: "do not use k8s.io/kubernetes directly"
41+
rules:
42+
prevent_kubernetes_dependency:
43+
list-mode: lax # allow unless explicitly denied
44+
deny:
45+
- pkg: k8s.io/kubernetes
46+
desc: "do not use k8s.io/kubernetes directly"
4747
errcheck:
4848
exclude-functions:
4949
- encoding/json.Marshal
@@ -83,12 +83,13 @@ linters-settings:
8383
- performance
8484
- style
8585
gofumpt:
86-
lang-version: "1.23.2"
8786
extra-rules: true
8887
lll:
8988
line-length: 150
9089

9190
issues:
91+
exclude-dirs:
92+
- tilt_modules
9293
exclude-rules:
9394
# ignore errcheck for code under a /test folder
9495
- path: "test/*"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ vet: ## Run go vet against code
110110
go vet ./...
111111

112112
lint: ## Run linters against code
113-
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
114-
golangci-lint run --out-format=github-actions --timeout 600s --skip-files "tilt_modules"
113+
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
114+
golangci-lint run --out-format=colored-line-number --timeout 600s
115115
@go install github.com/yoheimuta/protolint/cmd/protolint@latest
116116
protolint lint -config_path=.protolint.yaml ./api
117117

0 commit comments

Comments
 (0)