add target + installation for golangci-lint

This lets users locally run the same commands that are run in CI

Signed-off-by: Ashley Davis <ashley.davis@venafi.com>
This commit is contained in:
Ashley Davis 2023-12-13 16:17:34 +00:00
parent 7b36cfa808
commit dd61635f3b
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,10 @@
## @category CI
ci-presubmit: verify-imports verify-errexit verify-boilerplate verify-codegen verify-crds verify-modules
.PHONY: verify-golangci-lint
verify-golangci-lint: test/integration/versionchecker/testdata/test_manifests.tar | $(NEEDS_GOLANGCI-LINT)
find . -name go.mod -not \( -path "./$(BINDIR)/*" -prune \) -execdir $(GOLANGCI-LINT) run --timeout=30m --config=$(CURDIR)/.golangci.ci.yaml \;
.PHONY: verify-modules
verify-modules: | $(NEEDS_CMREL)
$(CMREL) validate-gomod --path $(shell pwd) --direct-import-modules github.com/cert-manager/cert-manager/cmd/ctl --no-dummy-modules github.com/cert-manager/cert-manager/integration-tests

View File

@ -63,6 +63,8 @@ TOOLS += crane=v0.16.1
TOOLS += boilersuite=v0.1.0
# https://pkg.go.dev/github.com/onsi/ginkgo/v2/ginkgo?tab=versions
TOOLS += ginkgo=$(shell awk '/ginkgo\/v2/ {print $$2}' go.mod)
# https://github.com/golangci/golangci-lint/releases
TOOLS += golangci-lint=v1.55.2
# Version of Gateway API install bundle https://gateway-api.sigs.k8s.io/v1alpha2/guides/#installing-gateway-api
GATEWAY_API_VERSION=v0.8.0
@ -239,6 +241,7 @@ GO_DEPENDENCIES += go-licenses=github.com/google/go-licenses
GO_DEPENDENCIES += gotestsum=gotest.tools/gotestsum
GO_DEPENDENCIES += crane=github.com/google/go-containerregistry/cmd/crane
GO_DEPENDENCIES += boilersuite=github.com/cert-manager/boilersuite
GO_DEPENDENCIES += golangci-lint=github.com/golangci/golangci-lint/cmd/golangci-lint
define go_dependency
$$(BINDIR)/downloaded/tools/$1@$($(call UC,$1)_VERSION)_%: | $$(NEEDS_GO) $$(BINDIR)/downloaded/tools