OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / spf13 / cast / Makefile
1 # A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
2
3 .PHONY: check fmt lint test test-race vet test-cover-html help
4 .DEFAULT_GOAL := help
5
6 check: test-race fmt vet lint ## Run tests and linters
7
8 test: ## Run tests
9         go test ./...
10
11 test-race: ## Run tests with race detector
12         go test -race ./...
13
14 fmt: ## Run gofmt linter
15         @for d in `go list` ; do \
16                 if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \
17                         echo "^ improperly formatted go files" && echo && exit 1; \
18                 fi \
19         done
20
21 lint: ## Run golint linter
22         @for d in `go list` ; do \
23                 if [ "`golint $$d | tee /dev/stderr`" ]; then \
24                         echo "^ golint errors!" && echo && exit 1; \
25                 fi \
26         done
27
28 vet: ## Run go vet linter
29         @if [ "`go vet | tee /dev/stderr`" ]; then \
30                 echo "^ go vet errors!" && echo && exit 1; \
31         fi
32
33 test-cover-html: ## Generate test coverage report
34         go test -coverprofile=coverage.out -covermode=count
35         go tool cover -func=coverage.out
36
37 help:
38         @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'