From ca8d7165dbc66c9007b8a559a3bece89d117891b Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Wed, 4 Jan 2023 10:40:53 -0500 Subject: [PATCH] Use the golangci-lint configured in Makefile in build tests We hit an issue on https://github.com/tektoncd/pipeline/pull/5941 due to the golangci-lint installed on the `test-runner` image being upgraded and reporting new issues that weren't encountered at the time of the v0.43.0 release. Ideally, the build tests job should be using the same golangci-lint version as is defined in the Makefile, so let's switch to calling a make target. Signed-off-by: Andrew Bayer --- Makefile | 4 ++++ test/presubmit-tests.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3f3c40a3000..be2839d8fbb 100644 --- a/Makefile +++ b/Makefile @@ -170,6 +170,10 @@ $(BIN)/golangci-lint: ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION)) golangci-lint: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint $Q $(GOLANGCILINT) run --modules-download-mode=vendor --max-issues-per-linter=0 --max-same-issues=0 --deadline 5m +.PHONY: golangci-lint-check +golangci-lint-check: | $(GOLANGCILINT) ; $(info $(M) Testing if golint has been done…) @ ## Run golangci-lint for build tests CI job + $Q $(GOLANGCILINT) run -j 1 --color=never + GOIMPORTS = $(BIN)/goimports $(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports diff --git a/test/presubmit-tests.sh b/test/presubmit-tests.sh index 6a8c81ca144..9369dd57cb3 100755 --- a/test/presubmit-tests.sh +++ b/test/presubmit-tests.sh @@ -33,7 +33,7 @@ function check_go_lint() { header "Testing if golint has been done" # deadline of 5m, and show all the issues - golangci-lint -j 1 --color=never run + GOFLAGS="-mod=mod" make golangci-lint-check if [[ $? != 0 ]]; then results_banner "Go Lint" 1