Set linters up

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
Alexey Vanin 2025-03-13 12:52:39 +03:00
parent 0c7a825bb1
commit f81bf9666e
3 changed files with 12 additions and 5 deletions

View file

@ -73,7 +73,6 @@ linters:
- gocognit
- contextcheck
- importas
- truecloudlab-linters
- perfsprint
- testifylint
- protogetter

View file

@ -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 ./...
@GOFLAGS="$(GOFLAGS)" go test ./...
# Clean all installed files
.PHONY: clean
clean:
rm -rf ./bin/*

View file

@ -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)
@ -18,7 +18,7 @@ $(LINT_DIR):
@@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)