Skip to content

Commit f610d6d

Browse files
committed
NO-JIRA: Update golanci-lint package version
1 parent a231aac commit f610d6d

File tree

2,441 files changed

+230222
-61628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,441 files changed

+230222
-61628
lines changed

.golangci.yml

Lines changed: 89 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,107 @@
1+
version: "2"
2+
13
run:
24
timeout: 5m
35
allow-parallel-runners: true
46

5-
issues:
6-
# don't skip warning about doc comments
7-
# don't exclude the default set of lint
8-
exclude-use-default: false
9-
# restore some of the defaults
10-
# (fill in the rest as needed)
11-
exclude-rules:
12-
- path: "api/*"
13-
linters:
14-
- lll
15-
- path: "pkg/*"
16-
linters:
17-
- dupl
18-
- lll
197
linters:
20-
disable-all: true
8+
default: none
219
enable:
10+
- asciicheck
11+
- bodyclose
12+
- dogsled
2213
- dupl
2314
- errcheck
24-
- exportloopref
25-
- ginkgolinter
15+
- errorlint
16+
- exhaustive
17+
- copyloopvar
18+
- goheader
2619
- goconst
27-
- gocyclo
28-
- gofmt
29-
- goimports
30-
- gosimple
20+
- gocritic
21+
- godot
22+
- goprintffuncname
23+
- gosec
3124
- govet
3225
- ineffassign
33-
- lll
3426
- misspell
3527
- nakedret
28+
- nolintlint
3629
- prealloc
37-
- revive
38-
- staticcheck
39-
- typecheck
30+
- lll
4031
- unconvert
4132
- unparam
4233
- unused
43-
44-
linters-settings:
45-
revive:
34+
- whitespace
35+
settings:
36+
goconst:
37+
min-len: 3
38+
min-occurrences: 3
39+
gocritic:
40+
enabled-tags:
41+
- diagnostic
42+
- experimental
43+
- opinionated
44+
- performance
45+
- style
46+
disabled-checks:
47+
- dupImport
48+
- ifElseChain
49+
- octalLiteral
50+
- whyNoLint
51+
- wrapperFunc
52+
- importShadow
53+
- unnamedResult
54+
- unnecessaryBlock
55+
settings:
56+
rangeValCopy:
57+
sizeThreshold: 512
58+
hugeParam:
59+
sizeThreshold: 512
60+
gocyclo:
61+
min-complexity: 16
62+
goheader:
63+
template-path: ./hack/boilerplate.go.txt
64+
dupl:
65+
threshold: 200
66+
govet:
67+
disable:
68+
- shadow
69+
lll:
70+
line-length: 300
71+
misspell:
72+
locale: US
73+
exclusions:
4674
rules:
47-
- name: comment-spacings
75+
# Exclude some linters from running on tests files.
76+
- path: _test(ing)?\.go
77+
linters:
78+
- gocyclo
79+
- errcheck
80+
- dupl
81+
- gosec
82+
- unparam
83+
- lll
84+
85+
# Ease some gocritic warnings on test files.
86+
- path: _test\.go
87+
text: "(unnamedResult|exitAfterDefer)"
88+
linters:
89+
- gocritic
90+
91+
# This is a "potential hardcoded credentials" warning. It's triggered by
92+
# any variable with 'secret' in the same, and thus hits a lot of false
93+
# positives in Kubernetes land where a Secret is an object type.
94+
- text: "G101:"
95+
linters:
96+
- gosec
97+
98+
# The header check doesn't correctly parse the header as a code comment and is
99+
# triggered by the perceived diff. The header check still correctly detects missing
100+
# license headers and is useful for some cases.
101+
- text: "Actual:"
102+
linters:
103+
- goheader
104+
105+
- path: vendor
106+
linters:
107+
- all

Makefile

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ lint: golangci-lint ## Run golangci-lint linter
147147
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
148148
$(GOLANGCI_LINT) run --fix
149149

150+
# Ignore the exit code of the fix lint, it will always error as there are unfixed issues
151+
# that cannot be fixed from historic commits.
152+
.PHONY: verify-lint-fix
153+
verify-lint-fix:
154+
make lint-fix 2>/dev/null || true
155+
git diff --exit-code
156+
150157
##@ Build
151158

152159
build-operator: ## Build operator binary, no additional checks or code generation
@@ -233,6 +240,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
233240
YQ = $(LOCALBIN)/yq
234241
HELM ?= $(LOCALBIN)/helm
235242
REFERENCE_DOC_GENERATOR ?= $(LOCALBIN)/crd-ref-docs
243+
KUBEAPI_LINT = $(LOCALBIN)/kube-api-linter.so
236244

237245
## Tool Versions
238246
YQ_VERSION = v4.45.2
@@ -241,37 +249,41 @@ HELM_VERSION ?= v3.17.3
241249
.PHONY: kustomize
242250
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
243251
$(KUSTOMIZE): $(LOCALBIN)
244-
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5)
252+
$(call go-install-tool,$(KUSTOMIZE),./vendor/sigs.k8s.io/kustomize/kustomize/v5)
245253

246254
.PHONY: controller-gen
247255
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
248256
$(CONTROLLER_GEN): $(LOCALBIN)
249-
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen)
257+
$(call go-install-tool,$(CONTROLLER_GEN),./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen)
250258

251259
.PHONY: envtest
252260
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
253261
$(ENVTEST): $(LOCALBIN)
254-
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest)
262+
$(call go-install-tool,$(ENVTEST),./vendor/sigs.k8s.io/controller-runtime/tools/setup-envtest)
255263

256264
.PHONY: golangci-lint
257265
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
258266
$(GOLANGCI_LINT): $(LOCALBIN)
259-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint)
267+
$(call go-install-tool,$(GOLANGCI_LINT),./vendor/github.com/golangci/golangci-lint/v2/cmd/golangci-lint)
260268

261269
.PHONY: crd-ref-docs
262270
crd-ref-docs: $(LOCALBIN) ## Download crd-ref-docs locally if necessary.
263-
$(call go-install-tool,$(REFERENCE_DOC_GENERATOR),github.com/elastic/crd-ref-docs)
271+
$(call go-install-tool,$(REFERENCE_DOC_GENERATOR),./vendor/github.com/elastic/crd-ref-docs)
272+
273+
.PHONY: kube-api-linter
274+
kube-api-linter: $(LOCALBIN)
275+
go build -mod=vendor -buildmode=plugin -o $(KUBEAPI_LINT) ./vendor/sigs.k8s.io/kube-api-linter/pkg/plugin
264276

265277
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
266278
# $1 - target path with name of binary
267-
# $2 - package url which can be installed
279+
# $2 - vendor code path of the package
268280
define go-install-tool
269281
@[ -f "$(1)" ] || { \
270282
set -e; \
271283
package=$(2) ;\
272-
echo "Downloading $${package}" ;\
284+
echo "Building $${package}" ;\
273285
rm -f $(1) || true ;\
274-
GOBIN=$(LOCALBIN) go install $${package} ;\
286+
go build -mod=vendor -o $(LOCALBIN) $${package} ;\
275287
}
276288
endef
277289

@@ -370,7 +382,7 @@ catalog-push: ## Push a catalog image.
370382

371383
## verify the changes are working as expected.
372384
.PHONY: verify
373-
verify: vet fmt golangci-lint verify-bindata verify-bindata-assets verify-generated
385+
verify: vet fmt verify-bindata verify-bindata-assets verify-generated
374386

375387
## update the relevant data based on new changes.
376388
.PHONY: update

0 commit comments

Comments
 (0)