chore(makefile): change gofmt toll to gofumpt
This commit is contained in:
parent
7abe52fd7d
commit
91cd4c1be5
12
Makefile
12
Makefile
@ -1,13 +1,13 @@
|
|||||||
DIST := dist
|
DIST := dist
|
||||||
EXECUTABLE := drone-telegram
|
EXECUTABLE := drone-telegram
|
||||||
GOFMT ?= gofmt "-s"
|
GOFMT ?= gofumpt -l -s
|
||||||
GO ?= go
|
GO ?= go
|
||||||
|
|
||||||
# for dockerhub
|
# for dockerhub
|
||||||
DEPLOY_ACCOUNT := appleboy
|
DEPLOY_ACCOUNT := appleboy
|
||||||
DEPLOY_IMAGE := $(EXECUTABLE)
|
DEPLOY_IMAGE := $(EXECUTABLE)
|
||||||
|
|
||||||
TARGETS ?= linux windows
|
TARGETS ?= linux darwin
|
||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
TAGS ?=
|
TAGS ?=
|
||||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||||
@ -27,6 +27,9 @@ endif
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
|
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
$(GO) get -u mvdan.cc/gofumpt; \
|
||||||
|
fi
|
||||||
$(GOFMT) -w $(SOURCES)
|
$(GOFMT) -w $(SOURCES)
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@ -54,6 +57,9 @@ misspell:
|
|||||||
|
|
||||||
.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 $(SOURCES)); \
|
@diff=$$($(GOFMT) -d $(SOURCES)); \
|
||||||
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:"; \
|
||||||
@ -81,7 +87,7 @@ release-build:
|
|||||||
@which gox > /dev/null; if [ $$? -ne 0 ]; then \
|
@which gox > /dev/null; if [ $$? -ne 0 ]; then \
|
||||||
$(GO) get -u github.com/mitchellh/gox; \
|
$(GO) get -u github.com/mitchellh/gox; \
|
||||||
fi
|
fi
|
||||||
gox -os="$(TARGETS)" -arch="amd64 386" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
|
gox -os="$(TARGETS)" -arch="amd64" -tags="$(TAGS)" -ldflags="-s -w $(LDFLAGS)" -output="$(DIST)/binaries/$(EXECUTABLE)-$(VERSION)-{{.OS}}-{{.Arch}}"
|
||||||
|
|
||||||
release-copy:
|
release-copy:
|
||||||
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
$(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
||||||
|
@ -290,7 +290,7 @@ func (p Plugin) Exec() (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to read file with template vars '%s': %v", p.Config.TemplateVarsFile, err)
|
return fmt.Errorf("unable to read file with template vars '%s': %v", p.Config.TemplateVarsFile, err)
|
||||||
}
|
}
|
||||||
var vars = make(map[string]string)
|
vars := make(map[string]string)
|
||||||
if err = json.Unmarshal(content, &vars); err != nil {
|
if err = json.Unmarshal(content, &vars); err != nil {
|
||||||
return fmt.Errorf("unable to unmarshall template vars from JSON file '%s': %v", p.Config.TemplateVarsFile, err)
|
return fmt.Errorf("unable to unmarshall template vars from JSON file '%s': %v", p.Config.TemplateVarsFile, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user