From dd61635f3bc4e0761ec81ed0f0df492c0e74eb0b Mon Sep 17 00:00:00 2001 From: Ashley Davis Date: Wed, 13 Dec 2023 16:17:34 +0000 Subject: [PATCH] add target + installation for golangci-lint This lets users locally run the same commands that are run in CI Signed-off-by: Ashley Davis --- make/ci.mk | 4 ++++ make/tools.mk | 3 +++ 2 files changed, 7 insertions(+) diff --git a/make/ci.mk b/make/ci.mk index 8e2e39c02..e1dbfc319 100644 --- a/make/ci.mk +++ b/make/ci.mk @@ -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 diff --git a/make/tools.mk b/make/tools.mk index 2c828fce5..32500fde3 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -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