From 2c10d9920fc5531c0e42a2ffffda66dbce4be024 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Mar 2025 12:52:39 +0300 Subject: [PATCH] [#1] Set linters up Signed-off-by: Alex Vanin --- .golangci.yml | 1 - Makefile | 10 +++++++++- mk/linters.mk | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 405bddc..fc8dd38 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -73,7 +73,6 @@ linters: - gocognit - contextcheck - importas - - truecloudlab-linters - perfsprint - testifylint - protogetter diff --git a/Makefile b/Makefile index a461dda..e66e478 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include mk/* + GOBIN ?= $(shell go env GOPATH)/bin PROTOC_VERSION ?= 25.6 @@ -34,7 +36,13 @@ protoc: protoc-bin done # Run Unit Test with go test +.PHONY: test test: GOFLAGS ?= "-count=1" test: @echo "> Running go test" - @GOFLAGS="$(GOFLAGS)" go test ./... \ No newline at end of file + @GOFLAGS="$(GOFLAGS)" go test ./... + +# Clean all installed files +.PHONY: clean +clean: + rm -rf ./bin/* diff --git a/mk/linters.mk b/mk/linters.mk index 1e9b082..bd1aa88 100644 --- a/mk/linters.mk +++ b/mk/linters.mk @@ -1,6 +1,6 @@ GO_VERSION ?= 1.22 -LINT_VERSION ?= 1.56.1 -TRUECLOUDLAB_LINT_VERSION ?= 0.0.5 +LINT_VERSION ?= 1.62.0 +TRUECLOUDLAB_LINT_VERSION ?= 0.0.8 BIN ?= bin OUTPUT_LINT_DIR ?= $(abspath $(BIN))/linters LINT_DIR ?= $(OUTPUT_LINT_DIR)/golangci-lint-$(LINT_VERSION)-v$(TRUECLOUDLAB_LINT_VERSION) @@ -11,14 +11,14 @@ TMP_DIR := .cache # Install linters $(LINT_DIR): @rm -rf $(OUTPUT_LINT_DIR) - @mkdir $(OUTPUT_LINT_DIR) + @mkdir -p $(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) + @CGO_ENABLED=1 GOBIN=$(LINT_DIR) go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint@v$(LINT_VERSION) # Run linters lint: $(LINT_DIR)