Compare commits

...

2 commits

Author SHA1 Message Date
f0376ee1e3
fixup: Remove frostfs-node specific configuration
Signed-off-by: George Bartolomey <george@bh4.ru>
2024-09-14 20:30:58 +03:00
9d574a3aa4
fixup: Add fumpt, gopls and staticcheck Make scenarios 2024-09-14 20:29:42 +03:00
5 changed files with 61 additions and 10 deletions

View file

@ -41,11 +41,6 @@ linters-settings:
truecloudlab-linters:
path: bin/linters/external_linters.so
original-url: git.frostfs.info/TrueCloudLab/linters.git
settings:
noliteral:
target-methods : ["reportFlushError", "reportError"]
disable-packages: ["codes", "err", "res","exec"]
constants-package: "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
linters:
enable:

19
mk/fumpt.mk Normal file
View file

@ -0,0 +1,19 @@
BIN ?= bin
GOFUMPT_VERSION ?= v0.7.0
GOFUMPT_DIR ?= $(abspath $(BIN))/gofumpt
GOFUMPT_VERSION_DIR ?= $(GOFUMPT_DIR)/$(GOFUMPT_VERSION)
.PHONY: fumpt fumpt-install
# Install gofumpt
fumpt-install:
@rm -rf $(GOFUMPT_DIR)
@mkdir $(GOFUMPT_DIR)
@GOBIN=$(GOFUMPT_VERSION_DIR) go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION)
$(GOFUMPT_VERSION_DIR): fumpt-install
# Run gofumpt
fumpt: $(GOFUMPT_VERSION_DIR)
@echo "⇒ Processing gofumpt check"
$(GOFUMPT_VERSION_DIR)/gofumpt -l -w cmd/ pkg/ misc/

24
mk/gopls.mk Normal file
View file

@ -0,0 +1,24 @@
BIN ?= bin
GOPLS_VERSION ?= v0.15.1
GOPLS_DIR ?= $(abspath $(BIN))/gopls
GOPLS_VERSION_DIR ?= $(GOPLS_DIR)/$(GOPLS_VERSION)
GOPLS_TEMP_FILE := $(shell mktemp)
.PHONY: gopls-install gopls-run
# Install gopls
gopls-install:
@rm -rf $(GOPLS_DIR)
@mkdir $(GOPLS_DIR)
@GOBIN=$(GOPLS_VERSION_DIR) go install golang.org/x/tools/gopls@$(GOPLS_VERSION)
$(GOPLS_VERSION_DIR): gopls-install
# Run gopls
gopls-run: $(GOPLS_VERSION_DIR)
$(GOPLS_VERSION_DIR)/gopls check $(SOURCES) 2>&1 >$(GOPLS_TEMP_FILE)
@if [[ $$(wc -l < $(GOPLS_TEMP_FILE)) -ne 0 ]]; then \
cat $(GOPLS_TEMP_FILE); \
exit 1; \
fi
rm $(GOPLS_TEMP_FILE)

View file

@ -23,8 +23,3 @@ $(LINT_DIR):
# Run linters
lint: $(LINT_DIR)
$(LINT_DIR)/golangci-lint run
# Run gofumpt
fumpt:
@echo "⇒ Processing gofumpt check"
@gofumpt -l -w cmd/ pkg/ misc/

18
mk/staticcheck.mk Normal file
View file

@ -0,0 +1,18 @@
BIN ?= bin
STATICCHECK_VERSION ?= 2024.1.1
STATICCHECK_DIR ?= $(abspath $(BIN))/staticcheck
STATICCHECK_VERSION_DIR ?= $(STATICCHECK_DIR)/$(STATICCHECK_VERSION)
.PHONY: staticcheck-install staticcheck-run
# Install staticcheck
staticcheck-install:
@rm -rf $(STATICCHECK_DIR)
@mkdir $(STATICCHECK_DIR)
@GOBIN=$(STATICCHECK_VERSION_DIR) go install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
$(STATICCHECK_VERSION_DIR): staticcheck-install
# Run staticcheck
staticcheck-run: $(STATICCHECK_VERSION_DIR)
@$(STATICCHECK_VERSION_DIR)/staticcheck ./...