Skip to content

Commit

Permalink
Use the golangci-lint configured in Makefile in build tests
Browse files Browse the repository at this point in the history
We hit an issue on tektoncd#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 <[email protected]>
  • Loading branch information
abayer committed Jan 4, 2023
1 parent e263924 commit eb6afae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb6afae

Please sign in to comment.