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
|
# for dockerhub
|
||||||
DEPLOY_ACCOUNT := appleboy
|
DEPLOY_ACCOUNT := appleboy
|
||||||
DEPLOY_IMAGE := $(EXECUTABLE)
|
DEPLOY_IMAGE := $(EXECUTABLE)
|
||||||
|
GOFMT ?= gofmt "-s"
|
||||||
|
|
||||||
TARGETS ?= linux darwin windows
|
TARGETS ?= linux darwin windows
|
||||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
||||||
|
GOFILES := find . -name "*.go" -type f -not -path "./vendor/*"
|
||||||
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,8 +29,17 @@ endif
|
|||||||
|
|
||||||
all: build
|
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:
|
fmt:
|
||||||
find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w
|
$(GOFILES) | xargs $(GOFMT) -w
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet $(PACKAGES)
|
go vet $(PACKAGES)
|
||||||
@ -51,7 +62,7 @@ unconvert:
|
|||||||
fi
|
fi
|
||||||
for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done;
|
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;
|
for PKG in $(PACKAGES); do go test -v -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done;
|
||||||
|
|
||||||
html:
|
html:
|
||||||
|
Loading…
Reference in New Issue
Block a user