Skip to content

Commit

Permalink
build: fix usage of local golangci-lint installation
Browse files Browse the repository at this point in the history
The make target `make lint` should prefer the locally installed
`golangci-lint` if the installed version matches the expected one.
This comes with the advantage of using the local cache.

This behaviour is broken since cilium#24664 (automate golangci-lint upgrades
with renovate).

This commit re-introduces the feature.

Fixes: cilium#24664

Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter authored and tklauser committed Sep 14, 2023
1 parent cbc2577 commit 66c4479
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ govet: ## Run govet on Go source files in the repository.
$(QUIET) $(GO_VET) ./...

golangci-lint: ## Run golangci-lint
ifneq (,$(findstring $(GOLANGCILINT_WANT_VERSION),$(GOLANGCILINT_VERSION)))
ifneq (,$(findstring $(GOLANGCILINT_WANT_VERSION:v%=%),$(GOLANGCILINT_VERSION)))
@$(ECHO_CHECK) golangci-lint $(GOLANGCI_LINT_ARGS)
$(QUIET) golangci-lint run $(GOLANGCI_LINT_ARGS)
else
Expand Down
2 changes: 1 addition & 1 deletion Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ endif
# renovate: datasource=docker depName=golangci/golangci-lint
GOLANGCILINT_WANT_VERSION = v1.54.2
GOLANGCILINT_IMAGE_SHA = sha256:2082f5379c48c46e447bc1b890512f3aa9339db5eeed1a483a34aae9476ba6ee
GOLANGCILINT_VERSION = $(shell golangci-lint version 2>/dev/null)
GOLANGCILINT_VERSION = $(shell golangci-lint version --format short 2>/dev/null)

VERSION = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION)
VERSION_MAJOR = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION | cut -d. -f1)
Expand Down

0 comments on commit 66c4479

Please sign in to comment.