go-prompt/Makefile

47 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

2017-07-03 15:52:39 +00:00
.DEFAULT_GOAL := help
2019-02-22 18:17:33 +00:00
SOURCES := $(shell find . -prune -o -name "*.go" -not -name '*_test.go' -print)
2020-09-18 15:04:52 +00:00
GOIMPORTS ?= goimports
GOCILINT ?= golangci-lint
2017-07-17 20:25:06 +00:00
.PHONY: setup
2017-07-03 15:52:39 +00:00
setup: ## Setup for required tools.
go get -u golang.org/x/tools/cmd/goimports
2020-09-18 15:04:52 +00:00
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u golang.org/x/tools/cmd/stringer
2017-07-03 15:52:39 +00:00
2017-07-17 20:25:06 +00:00
.PHONY: fmt
fmt: $(SOURCES) ## Formatting source codes.
2020-09-18 15:04:52 +00:00
@$(GOIMPORTS) -w $^
2017-07-03 15:52:39 +00:00
2017-07-17 20:25:06 +00:00
.PHONY: lint
2020-09-18 15:04:52 +00:00
lint: ## Run golangci-lint.
@$(GOCILINT) run --no-config --disable-all --enable=goimports --enable=misspell ./...
2017-07-03 15:52:39 +00:00
2017-07-17 20:25:06 +00:00
.PHONY: test
test: ## Run tests with race condition checking.
@go test -race ./...
.PHONY: bench
bench: ## Run benchmarks.
@go test -bench=. -run=- -benchmem ./...
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-12-14 13:34:13 +00:00
.PHONY: generate
generate: ## Run go generate
@go generate ./...
.PHONY: build
build: ## Build example command lines.
./_example/build.sh
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}'