Skip to content

Commit ea31066

Browse files
committed
Bump golangci-lint and remove unused tools
Our prior version of golangci-lint is not compatible with go 1.20 [1] so update that now to front run our go version bump. Fix some low hanging text/ linter excludes. Switch to a unique tools build tag to work around golangci-lint dependency compile failure [2]. While here remove some old Jenkins test and code coverage tools that are no longer needed. [1] - golangci/golangci-lint#3565 [2] - ryancurrah/gomodguard#33
1 parent 457d553 commit ea31066

File tree

13 files changed

+354
-559
lines changed

13 files changed

+354
-559
lines changed

.golangci.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ linters:
2525
enable:
2626
- asciicheck
2727
- bodyclose
28-
- deadcode
2928
- depguard
3029
- dogsled
3130
- errcheck
@@ -50,12 +49,11 @@ linters:
5049
- revive
5150
- rowserrcheck
5251
- staticcheck
53-
- structcheck
5452
- stylecheck
5553
- typecheck
5654
- unconvert
5755
- unparam
58-
- varcheck
56+
- unused
5957

6058
issues:
6159
max-same-issues: 0
@@ -70,13 +68,14 @@ issues:
7068
exclude-rules:
7169
- linters:
7270
- revive
73-
text: ".*should have comment.* or be unexported"
71+
text: ".*should have (a package )?comment.*"
7472
- linters:
75-
- whitespace
76-
- godot
77-
path: test/
78-
# Dot imports for gomega or ginkgo are allowed
79-
# within test files.
73+
- revive
74+
text: "^exported: comment on exported const"
75+
- linters:
76+
- gosec
77+
text: "G114: Use of net/http serve function that has no support for setting timeouts"
78+
# Dot imports for gomega or ginkgo are allowed within test files.
8079
- path: test/
8180
text: should not use dot imports
8281
# All of our webhooks follow the pattern of passing the webhook context which contains fields like the Client.

Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ CRD_REF_DOCS := $(TOOLS_BIN_DIR)/crd-ref-docs
4444
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
4545
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
4646
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
47-
GO_JUNIT_REPORT := $(TOOLS_BIN_DIR)/go-junit-report
4847
GOCOVMERGE := $(TOOLS_BIN_DIR)/gocovmerge
4948
GOCOV := $(TOOLS_BIN_DIR)/gocov
5049
GOCOV_XML := $(TOOLS_BIN_DIR)/gocov-xml
@@ -173,9 +172,8 @@ web-console-validator: prereqs generate lint-go web-console-validator-only ## Bu
173172

174173
TOOLING_BINARIES := $(CRD_REF_DOCS) $(CONTROLLER_GEN) $(GOLANGCI_LINT) \
175174
$(KUSTOMIZE) \
176-
$(KUBE_APISERVER) $(KUBEBUILDER) $(KUBECTL) \
177-
$(ETCD) $(GINKGO) $(GO_JUNIT_REPORT) \
178-
$(GOCOVMERGE) $(GOCOV) $(GOCOV_XML)
175+
$(KUBE_APISERVER) $(KUBEBUILDER) $(KUBECTL) $(ETCD) \
176+
$(GINKGO) $(GOCOVMERGE) $(GOCOV) $(GOCOV_XML)
179177
tools: $(TOOLING_BINARIES) ## Build tooling binaries
180178
.PHONY: $(TOOLING_BINARIES)
181179
$(TOOLING_BINARIES):

hack/tools/Makefile

+8-20
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ CONTROLLER_GEN := $(BIN_DIR)/controller-gen
3030
SETUP_ENVTEST := $(BIN_DIR)/setup-envtest
3131
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint
3232
KUSTOMIZE := $(BIN_DIR)/kustomize
33-
GO_JUNIT_REPORT := $(BIN_DIR)/go-junit-report
3433
GINKGO := $(BIN_DIR)/ginkgo
3534
GOCOVMERGE := $(BIN_DIR)/gocovmerge
36-
GOCOVER_COBERTURA := $(BIN_DIR)/gocover-cobertura
3735
KUBEBUILDER := $(BIN_DIR)/kubebuilder
3836
ETCD := $(BIN_DIR)/etcd
3937
KUBE_APISERVER := $(BIN_DIR)/kube-apiserver
@@ -56,57 +54,47 @@ help: ## Display this help
5654
.PHONY: $(CRD_REF_DOCS)
5755
crd-ref-docs: $(CRD_REF_DOCS) ## Install crd-ref-docs
5856
$(CRD_REF_DOCS):
59-
go build -tags=tools -o $@ github.com/elastic/crd-ref-docs
57+
go build -tags=vmop_tools -o $@ github.com/elastic/crd-ref-docs
6058

6159
.PHONY: $(CONTROLLER_GEN)
6260
controller-gen: $(CONTROLLER_GEN) ## Install controller-gen
6361
$(CONTROLLER_GEN): go.mod
64-
go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen
62+
go build -tags=vmop_tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen
6563

6664
.PHONY:$(SETUP_ENVTEST)
6765
setup-envtest: $(SETUP_ENVTEST) ## Install setup-envtest
6866
$(SETUP_ENVTEST): go.mod
69-
go build -tags=tools -o $@ sigs.k8s.io/controller-runtime/tools/setup-envtest
67+
go build -tags=vmop_tools -o $@ sigs.k8s.io/controller-runtime/tools/setup-envtest
7068

7169
.PHONY: $(GOLANGCI_LINT)
7270
golangci-lint: $(GOLANGCI_LINT) ## Install golangci-lint
7371
$(GOLANGCI_LINT):
74-
go build -tags=tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint
72+
go build -tags=vmop_tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint
7573

7674
.PHONY: $(KUSTOMIZE)
7775
kustomize: $(KUSTOMIZE) ## Install kustomize
7876
$(KUSTOMIZE):
7977
../ensure-kustomize.sh
8078

81-
.PHONY: $(GO_JUNIT_REPORT)
82-
go-junit-report: $(GO_JUNIT_REPORT) ## Install go-junit-report
83-
$(GO_JUNIT_REPORT): go.mod
84-
go build -tags=tools -o $@ github.com/jstemmer/go-junit-report/v2
85-
8679
.PHONY: $(GINKGO)
8780
ginkgo: $(GINKGO) ## Install ginkgo
8881
$(GINKGO): go.mod
89-
go build -tags=tools -o $@ github.com/onsi/ginkgo/ginkgo
82+
go build -tags=vmop_tools -o $@ github.com/onsi/ginkgo/ginkgo
9083

9184
.PHONY: $(GOCOVMERGE)
9285
gocovmerge: $(GOCOVMERGE) ## Install gocovmerge
9386
$(GOCOVMERGE): go.mod
94-
go build -tags=tools -o $@ github.com/wadey/gocovmerge
95-
96-
.PHONY: $(GOCOVER_COBERTURA)
97-
gocover-cobertura: $(GOCOVER_COBERTURA) ## Install gocover-cobertura
98-
$(GOCOVER_COBERTURA): go.mod
99-
go build -tags=tools -o $@ github.com/t-yuki/gocover-cobertura
87+
go build -tags=vmop_tools -o $@ github.com/wadey/gocovmerge
10088

10189
.PHONY: $(GOCOV)
10290
gocov: $(GOCOV) ## Install gocov
10391
$(GOCOV): go.mod
104-
go build -tags=tools -o $@ github.com/axw/gocov/gocov
92+
go build -tags=vmop_tools -o $@ github.com/axw/gocov/gocov
10593

10694
.PHONY: $(GOCOV_XML)
10795
gocov-xml: $(GOCOV_XML) ## Install gocov-xml
10896
$(GOCOV_XML): go.mod
109-
go build -tags=tools -o $@ github.com/AlekSi/gocov-xml
97+
go build -tags=vmop_tools -o $@ github.com/AlekSi/gocov-xml
11098

11199
.PHONY: $(KUBEBUILDER)
112100
kubebuilder: $(KUBEBUILDER) ## Install kubebuilder

0 commit comments

Comments
 (0)