mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-07-02 21:52:51 +08:00
refactor: check gofmt error. (#63)
This commit is contained in:
parent
c2776cbaed
commit
a4dc098318
15
Makefile
15
Makefile
@ -6,9 +6,11 @@ EXECUTABLE := drone-ssh
|
||||
# for dockerhub
|
||||
DEPLOY_ACCOUNT := appleboy
|
||||
DEPLOY_IMAGE := $(EXECUTABLE)
|
||||
GOFMT ?= gofmt "-s"
|
||||
|
||||
TARGETS ?= linux darwin windows
|
||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
||||
GOFILES := find . -name "*.go" -type f -not -path "./vendor/*"
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
TAGS ?=
|
||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
|
||||
@ -27,8 +29,17 @@ endif
|
||||
|
||||
all: build
|
||||
|
||||
.PHONY: fmt-check
|
||||
fmt-check:
|
||||
# get all go files and run go fmt on them
|
||||
@files=$$($(GOFILES) | xargs $(GOFMT) -l); if [ -n "$$files" ]; then \
|
||||
echo "Please run 'make fmt' and commit the result:"; \
|
||||
echo "$${files}"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
|
||||
fmt:
|
||||
find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w
|
||||
$(GOFILES) | xargs $(GOFMT) -w
|
||||
|
||||
vet:
|
||||
go vet $(PACKAGES)
|
||||
@ -51,7 +62,7 @@ unconvert:
|
||||
fi
|
||||
for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done;
|
||||
|
||||
test:
|
||||
test: fmt-check
|
||||
for PKG in $(PACKAGES); do go test -v -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done;
|
||||
|
||||
html:
|
||||
|
Loading…
Reference in New Issue
Block a user