Makefile: Use linter docker image for the lint target.
@@ -17,6 +17,9 @@ ENABLE_BTFGEN ?= false
BPFTOOL ?= bpftool
ARCH ?= $(shell uname -m | sed 's/x86_64/x86/' | sed 's/aarch64/arm64/' | sed 's/ppc64le/powerpc/' | sed 's/mips.*/mips/')
+# This version number must be kept in sync with CI workflow lint one.
+LINTER_VERSION ?= v1.49.0
+
# Adds a '-dirty' suffix to version string if there are uncommitted changes
changes := $(shell git status --porcelain)
ifeq ($(changes),)
@@ -178,7 +181,7 @@ generate-documentation:
go run -tags docs cmd/gen-doc/gen-doc.go -repo $(shell pwd)
lint:
-# This version number must be kept in sync with CI workflow lint one.
+ docker build -t linter -f Dockerfiles/linter.Dockerfile --build-arg VERSION=$(LINTER_VERSION) Dockerfiles
# XDG_CACHE_HOME is necessary to avoid this type of errors:
# ERRO Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: failed to initialize build cache at /.cache/go-build: mkdir /.cache: permission denied
# Process 15167 has exited with status 3
@@ -186,7 +189,7 @@ lint:
docker run --rm --env XDG_CACHE_HOME=/tmp/xdg_home_cache \
--env GOLANGCI_LINT_CACHE=/tmp/golangci_lint_cache \
--user $(shell id -u):$(shell id -g) -v $(shell pwd):/app -w /app \
- golangci/golangci-lint:v1.49.0 golangci-lint run --fix
+ linter
# minikube
LIVENESS_PROBE ?= true
