2017-06-13 05:50:42 +03:00
|
|
|
GOFMT ?= gofmt "-s"
|
|
|
|
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
|
|
|
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
|
|
|
|
|
2018-01-24 06:06:42 +03:00
|
|
|
all: install
|
2017-06-13 05:50:42 +03:00
|
|
|
|
|
|
|
install: deps
|
|
|
|
govendor sync
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
go test -v -covermode=count -coverprofile=coverage.out
|
|
|
|
|
|
|
|
.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)
|