From 18cdf31e284903630dc0e0e4604fb20490a5aa24 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 23 Jan 2021 09:42:33 +0800 Subject: [PATCH] chore: switch gofmt to gofumpt --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7b5845b..9a90448 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ EXECUTABLE := gorush GO ?= go DEPLOY_ACCOUNT := appleboy DEPLOY_IMAGE := $(EXECUTABLE) -GOFMT ?= gofmt "-s" +GOFMT ?= gofumpt -l -s TARGETS ?= linux darwin windows openbsd ARCHS ?= amd64 386 @@ -41,10 +41,16 @@ endif .PHONY: fmt fmt: + @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GO) get -u mvdan.cc/gofumpt; \ + fi $(GOFMT) -w $(GOFILES) .PHONY: fmt-check fmt-check: + @hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + $(GO) get -u mvdan.cc/gofumpt; \ + fi @diff=$$($(GOFMT) -d $(GOFILES)); \ if [ -n "$$diff" ]; then \ echo "Please run 'make fmt' and commit the result:"; \