basic/mk/gopls.mk
George Bartolomey 887b238f4b
[#4] Synchronize with frostfs-node repository
- gitlint removed
- golangci-lint modified
- gofumpt added
- go-staticcheck-repo-mod and go-mod-tidy added
- mk scripts added with linters scenarios

Signed-off-by: George Bartolomey <george@bh4.ru>
2024-09-18 10:12:43 +03:00

24 lines
624 B
Makefile

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)