From a55600893efeadfc48a83f3f2529d846f4d534c3 Mon Sep 17 00:00:00 2001 From: Ekaterina Lebedeva Date: Fri, 2 Aug 2024 12:31:59 +0300 Subject: [PATCH] [#1266] Makefile: Specify gofumpt version Add target to install gofumpt, fix target to run gofumpt. Signed-off-by: Ekaterina Lebedeva --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c93d06aa..11111d9a 100755 --- a/Makefile +++ b/Makefile @@ -46,6 +46,10 @@ STATICCHECK_VERSION_DIR ?= $(STATICCHECK_DIR)/$(STATICCHECK_VERSION) SOURCES = $(shell find . -type f -name "*.go" -print) +GOFUMPT_VERSION ?= v0.6.0 +GOFUMPT_DIR ?= $(abspath $(BIN))/gofumpt +GOFUMPT_VERSION_DIR ?= $(GOFUMPT_DIR)/$(GOFUMPT_VERSION) + GOPLS_VERSION ?= v0.15.1 GOPLS_DIR ?= $(abspath $(BIN))/gopls GOPLS_VERSION_DIR ?= $(GOPLS_DIR)/$(GOPLS_VERSION) @@ -165,10 +169,19 @@ imports: @echo "⇒ Processing goimports check" @goimports -w cmd/ pkg/ misc/ +# Install gofumpt +fumpt-install: + @rm -rf $(GOFUMPT_DIR) + @mkdir $(GOFUMPT_DIR) + @GOBIN=$(GOFUMPT_VERSION_DIR) go install mvdan.cc/gofumpt@$(GOFUMPT_VERSION) + # Run gofumpt fumpt: + @if [ ! -d "$(GOFUMPT_VERSION_DIR)" ]; then \ + make fumpt-install; \ + fi @echo "⇒ Processing gofumpt check" - @gofumpt -l -w cmd/ pkg/ misc/ + $(GOFUMPT_VERSION_DIR)/gofumpt -l -w cmd/ pkg/ misc/ # Run Unit Test with go test test: GOFLAGS ?= "-count=1"