chore: switch gofmt to gofumpt

This commit is contained in:
Bo-Yi Wu 2021-01-23 09:42:33 +08:00
parent d77e7fe4f2
commit 18cdf31e28
1 changed files with 7 additions and 1 deletions

View File

@ -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:"; \