2017-07-03 15:52:39 +00:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2018-12-09 11:42:33 +00:00
|
|
|
SOURCES := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
|
|
|
|
|
2017-07-17 20:25:06 +00:00
|
|
|
.PHONY: setup
|
2017-07-03 15:52:39 +00:00
|
|
|
setup: ## Setup for required tools.
|
2018-10-25 13:59:47 +00:00
|
|
|
go get -u golang.org/x/lint/golint
|
|
|
|
go get -u golang.org/x/tools/cmd/goimports
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
2018-02-12 16:11:54 +00:00
|
|
|
go get -u github.com/golang/dep/cmd/dep
|
|
|
|
dep ensure
|
2017-07-03 15:52:39 +00:00
|
|
|
|
2017-07-17 20:25:06 +00:00
|
|
|
.PHONY: fmt
|
2018-12-09 11:42:33 +00:00
|
|
|
fmt: $(SOURCES) ## Formatting source codes.
|
|
|
|
@goimports -w $^
|
2017-07-03 15:52:39 +00:00
|
|
|
|
2017-07-17 20:25:06 +00:00
|
|
|
.PHONY: lint
|
2017-07-03 15:52:39 +00:00
|
|
|
lint: ## Run golint and go vet.
|
2017-07-17 20:32:25 +00:00
|
|
|
@golint .
|
2018-10-25 13:59:47 +00:00
|
|
|
@golint -set_exit_status=1
|
2017-07-17 20:32:25 +00:00
|
|
|
@go vet .
|
2017-07-03 15:52:39 +00:00
|
|
|
|
2017-07-17 20:25:06 +00:00
|
|
|
.PHONY: test
|
2018-10-25 13:59:47 +00:00
|
|
|
test: ## Run the tests with race condition checking.
|
|
|
|
@go test -race .
|
2017-07-03 15:52:39 +00:00
|
|
|
|
2018-02-15 09:15:32 +00:00
|
|
|
.PHONY: coverage
|
|
|
|
cover: ## Run the tests.
|
|
|
|
@go test -coverprofile=coverage.o
|
|
|
|
@go tool cover -func=coverage.o
|
|
|
|
|
2018-10-25 13:59:47 +00:00
|
|
|
.PHONY: build
|
|
|
|
build: ## Build example command lines.
|
2018-12-09 11:42:33 +00:00
|
|
|
./_example/build.sh
|
2017-10-08 11:58:09 +00:00
|
|
|
|
2017-07-17 20:25:06 +00:00
|
|
|
.PHONY: help
|
2017-07-03 15:52:39 +00:00
|
|
|
help: ## Show help text
|
|
|
|
@echo "Commands:"
|
2017-07-17 20:25:06 +00:00
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'
|