chore: switch gofmt to gofumpt
This commit is contained in:
parent
d77e7fe4f2
commit
18cdf31e28
8
Makefile
8
Makefile
|
@ -4,7 +4,7 @@ EXECUTABLE := gorush
|
||||||
GO ?= go
|
GO ?= go
|
||||||
DEPLOY_ACCOUNT := appleboy
|
DEPLOY_ACCOUNT := appleboy
|
||||||
DEPLOY_IMAGE := $(EXECUTABLE)
|
DEPLOY_IMAGE := $(EXECUTABLE)
|
||||||
GOFMT ?= gofmt "-s"
|
GOFMT ?= gofumpt -l -s
|
||||||
|
|
||||||
TARGETS ?= linux darwin windows openbsd
|
TARGETS ?= linux darwin windows openbsd
|
||||||
ARCHS ?= amd64 386
|
ARCHS ?= amd64 386
|
||||||
|
@ -41,10 +41,16 @@ endif
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt:
|
fmt:
|
||||||
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
$(GO) get -u mvdan.cc/gofumpt; \
|
||||||
|
fi
|
||||||
$(GOFMT) -w $(GOFILES)
|
$(GOFMT) -w $(GOFILES)
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
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)); \
|
@diff=$$($(GOFMT) -d $(GOFILES)); \
|
||||||
if [ -n "$$diff" ]; then \
|
if [ -n "$$diff" ]; then \
|
||||||
echo "Please run 'make fmt' and commit the result:"; \
|
echo "Please run 'make fmt' and commit the result:"; \
|
||||||
|
|
Loading…
Reference in New Issue