diff --git a/Makefile b/Makefile index 78f28fe..8b8b245 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ GO_VERSION ?= 1.22 LINT_VERSION ?= 1.60.3 BINDIR = bin +OUTPUT_LINT_DIR ?= $(abspath $(BINDIR))/linters +LINT_DIR = $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION) +TMP_DIR := .cache + # Binaries to build CMDS = $(addprefix frostfs-, $(notdir $(wildcard cmd/*))) BINS = $(addprefix $(BINDIR)/, $(CMDS)) @@ -64,7 +68,16 @@ format: # Run linters lint: - @golangci-lint --timeout=5m run + @if [ ! -d "$(LINT_DIR)" ]; then \ + make lint-install; \ + fi + $(LINT_DIR)/golangci-lint run --timeout=5m + +# Install linters +lint-install: + @rm -rf $(OUTPUT_LINT_DIR) + @mkdir -p $(OUTPUT_LINT_DIR) + @CGO_ENABLED=1 GOBIN=$(LINT_DIR) go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint@v$(LINT_VERSION) # Run linters in Docker docker/lint: