Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golangci-lint and remove unused tools #70

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
Expand All @@ -50,12 +49,11 @@ linters:
- revive
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- varcheck
- unused

issues:
max-same-issues: 0
Expand All @@ -70,13 +68,14 @@ issues:
exclude-rules:
- linters:
- revive
text: ".*should have comment.* or be unexported"
text: ".*should have (a package )?comment.*"
- linters:
- whitespace
- godot
path: test/
# Dot imports for gomega or ginkgo are allowed
# within test files.
- revive
text: "^exported: comment on exported const"
- linters:
- gosec
text: "G114: Use of net/http serve function that has no support for setting timeouts"
# Dot imports for gomega or ginkgo are allowed within test files.
- path: test/
text: should not use dot imports
# All of our webhooks follow the pattern of passing the webhook context which contains fields like the Client.
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ CRD_REF_DOCS := $(TOOLS_BIN_DIR)/crd-ref-docs
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
GO_JUNIT_REPORT := $(TOOLS_BIN_DIR)/go-junit-report
GOCOVMERGE := $(TOOLS_BIN_DIR)/gocovmerge
GOCOV := $(TOOLS_BIN_DIR)/gocov
GOCOV_XML := $(TOOLS_BIN_DIR)/gocov-xml
Expand Down Expand Up @@ -173,9 +172,8 @@ web-console-validator: prereqs generate lint-go web-console-validator-only ## Bu

TOOLING_BINARIES := $(CRD_REF_DOCS) $(CONTROLLER_GEN) $(GOLANGCI_LINT) \
$(KUSTOMIZE) \
$(KUBE_APISERVER) $(KUBEBUILDER) $(KUBECTL) \
$(ETCD) $(GINKGO) $(GO_JUNIT_REPORT) \
$(GOCOVMERGE) $(GOCOV) $(GOCOV_XML)
$(KUBE_APISERVER) $(KUBEBUILDER) $(KUBECTL) $(ETCD) \
$(GINKGO) $(GOCOVMERGE) $(GOCOV) $(GOCOV_XML)
tools: $(TOOLING_BINARIES) ## Build tooling binaries
.PHONY: $(TOOLING_BINARIES)
$(TOOLING_BINARIES):
Expand Down
28 changes: 8 additions & 20 deletions hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ CONTROLLER_GEN := $(BIN_DIR)/controller-gen
SETUP_ENVTEST := $(BIN_DIR)/setup-envtest
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint
KUSTOMIZE := $(BIN_DIR)/kustomize
GO_JUNIT_REPORT := $(BIN_DIR)/go-junit-report
GINKGO := $(BIN_DIR)/ginkgo
GOCOVMERGE := $(BIN_DIR)/gocovmerge
GOCOVER_COBERTURA := $(BIN_DIR)/gocover-cobertura
KUBEBUILDER := $(BIN_DIR)/kubebuilder
ETCD := $(BIN_DIR)/etcd
KUBE_APISERVER := $(BIN_DIR)/kube-apiserver
Expand All @@ -56,57 +54,47 @@ help: ## Display this help
.PHONY: $(CRD_REF_DOCS)
crd-ref-docs: $(CRD_REF_DOCS) ## Install crd-ref-docs
$(CRD_REF_DOCS):
go build -tags=tools -o $@ github.com/elastic/crd-ref-docs
go build -tags=vmop_tools -o $@ github.com/elastic/crd-ref-docs

.PHONY: $(CONTROLLER_GEN)
controller-gen: $(CONTROLLER_GEN) ## Install controller-gen
$(CONTROLLER_GEN): go.mod
go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen
go build -tags=vmop_tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen

.PHONY:$(SETUP_ENVTEST)
setup-envtest: $(SETUP_ENVTEST) ## Install setup-envtest
$(SETUP_ENVTEST): go.mod
go build -tags=tools -o $@ sigs.k8s.io/controller-runtime/tools/setup-envtest
go build -tags=vmop_tools -o $@ sigs.k8s.io/controller-runtime/tools/setup-envtest

.PHONY: $(GOLANGCI_LINT)
golangci-lint: $(GOLANGCI_LINT) ## Install golangci-lint
$(GOLANGCI_LINT):
go build -tags=tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint
go build -tags=vmop_tools -o $@ github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: $(KUSTOMIZE)
kustomize: $(KUSTOMIZE) ## Install kustomize
$(KUSTOMIZE):
../ensure-kustomize.sh

.PHONY: $(GO_JUNIT_REPORT)
go-junit-report: $(GO_JUNIT_REPORT) ## Install go-junit-report
$(GO_JUNIT_REPORT): go.mod
go build -tags=tools -o $@ github.com/jstemmer/go-junit-report/v2

.PHONY: $(GINKGO)
ginkgo: $(GINKGO) ## Install ginkgo
$(GINKGO): go.mod
go build -tags=tools -o $@ github.com/onsi/ginkgo/ginkgo
go build -tags=vmop_tools -o $@ github.com/onsi/ginkgo/ginkgo

.PHONY: $(GOCOVMERGE)
gocovmerge: $(GOCOVMERGE) ## Install gocovmerge
$(GOCOVMERGE): go.mod
go build -tags=tools -o $@ github.com/wadey/gocovmerge

.PHONY: $(GOCOVER_COBERTURA)
gocover-cobertura: $(GOCOVER_COBERTURA) ## Install gocover-cobertura
$(GOCOVER_COBERTURA): go.mod
go build -tags=tools -o $@ github.com/t-yuki/gocover-cobertura
go build -tags=vmop_tools -o $@ github.com/wadey/gocovmerge

.PHONY: $(GOCOV)
gocov: $(GOCOV) ## Install gocov
$(GOCOV): go.mod
go build -tags=tools -o $@ github.com/axw/gocov/gocov
go build -tags=vmop_tools -o $@ github.com/axw/gocov/gocov

.PHONY: $(GOCOV_XML)
gocov-xml: $(GOCOV_XML) ## Install gocov-xml
$(GOCOV_XML): go.mod
go build -tags=tools -o $@ github.com/AlekSi/gocov-xml
go build -tags=vmop_tools -o $@ github.com/AlekSi/gocov-xml

.PHONY: $(KUBEBUILDER)
kubebuilder: $(KUBEBUILDER) ## Install kubebuilder
Expand Down
Loading