...

Text file src/github.com/spf13/cast/Makefile

Documentation: github.com/spf13/cast

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

View as plain text