26 lines
868 B
Makefile
26 lines
868 B
Makefile
|
GO_VERSION ?= 1.22
|
||
|
LINT_VERSION ?= 1.56.1
|
||
|
TRUECLOUDLAB_LINT_VERSION ?= 0.0.5
|
||
|
BIN ?= bin
|
||
|
OUTPUT_LINT_DIR ?= $(abspath $(BIN))/linters
|
||
|
LINT_DIR ?= $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION)-v$(TRUECLOUDLAB_LINT_VERSION)
|
||
|
TMP_DIR := .cache
|
||
|
|
||
|
.PHONY: lint fumpt
|
||
|
|
||
|
# Install linters
|
||
|
$(LINT_DIR):
|
||
|
@rm -rf $(OUTPUT_LINT_DIR)
|
||
|
@mkdir $(OUTPUT_LINT_DIR)
|
||
|
@mkdir -p $(TMP_DIR)
|
||
|
@rm -rf $(TMP_DIR)/linters
|
||
|
@git -c advice.detachedHead=false clone --branch v$(TRUECLOUDLAB_LINT_VERSION) https://git.frostfs.info/TrueCloudLab/linters.git $(TMP_DIR)/linters
|
||
|
@@make -C $(TMP_DIR)/linters lib CGO_ENABLED=1 OUT_DIR=$(OUTPUT_LINT_DIR)
|
||
|
@rm -rf $(TMP_DIR)/linters
|
||
|
@rmdir $(TMP_DIR) 2>/dev/null || true
|
||
|
@CGO_ENABLED=1 GOBIN=$(LINT_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(LINT_VERSION)
|
||
|
|
||
|
# Run linters
|
||
|
lint: $(LINT_DIR)
|
||
|
$(LINT_DIR)/golangci-lint run
|