2017-06-13 02:50:42 +00:00
|
|
|
GOFMT ?= gofmt "-s"
|
|
|
|
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
|
|
|
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
|
|
|
|
|
2018-01-24 03:06:42 +00:00
|
|
|
all: install
|
2017-06-13 02:50:42 +00:00
|
|
|
|
|
|
|
install: deps
|
|
|
|
govendor sync
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
2018-01-26 03:46:11 +00:00
|
|
|
sh coverage.sh
|
2017-06-13 02:50:42 +00:00
|
|
|
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
|
|
|
$(GOFMT) -w $(GOFILES)
|
|
|
|
|
|
|
|
.PHONY: fmt-check
|
|
|
|
fmt-check:
|
|
|
|
# get all go files and run go fmt on them
|
|
|
|
@diff=$$($(GOFMT) -d $(GOFILES)); \
|
|
|
|
if [ -n "$$diff" ]; then \
|
|
|
|
echo "Please run 'make fmt' and commit the result:"; \
|
|
|
|
echo "$${diff}"; \
|
|
|
|
exit 1; \
|
|
|
|
fi;
|
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet $(PACKAGES)
|
|
|
|
|
|
|
|
deps:
|
|
|
|
@hash govendor > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
go get -u github.com/kardianos/govendor; \
|
|
|
|
fi
|
|
|
|
@hash embedmd > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
go get -u github.com/campoy/embedmd; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
embedmd:
|
|
|
|
embedmd -d *.md
|
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
go get -u github.com/golang/lint/golint; \
|
|
|
|
fi
|
|
|
|
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
|
|
|
|
|
|
|
|
.PHONY: misspell-check
|
|
|
|
misspell-check:
|
|
|
|
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
go get -u github.com/client9/misspell/cmd/misspell; \
|
|
|
|
fi
|
|
|
|
misspell -error $(GOFILES)
|
|
|
|
|
|
|
|
.PHONY: misspell
|
|
|
|
misspell:
|
|
|
|
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
|
|
go get -u github.com/client9/misspell/cmd/misspell; \
|
|
|
|
fi
|
|
|
|
misspell -w $(GOFILES)
|