forked from c-bata/go-prompt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.DEFAULT_GOAL := help
SOURCES := $(shell find . -prune -o -name "*.go" -not -name '*_test.go' -print)
GOIMPORTS ?= goimports
GOCILINT ?= golangci-lint
.PHONY: setup
setup: ## Setup for required tools.
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u golang.org/x/tools/cmd/stringer
.PHONY: fmt
fmt: $(SOURCES) ## Formatting source codes.
@$(GOIMPORTS) -w $^
.PHONY: lint
lint: ## Run golangci-lint.
@$(GOCILINT) run --no-config --disable-all --enable=goimports --enable=misspell ./...
.PHONY: test
test: ## Run tests with race condition checking.
@go test -race ./...
.PHONY: bench
bench: ## Run benchmarks.
@go test -bench=. -run=- -benchmem ./...
.PHONY: coverage
cover: ## Run the tests.
@go test -coverprofile=coverage.o
@go tool cover -func=coverage.o
.PHONY: generate
generate: ## Run go generate
@go generate ./...
.PHONY: build
build: ## Build example command lines.
./_example/build.sh
.PHONY: build_app
build_app: ## Build testing application.
ifdef GO_RPOMPT_BUILD_PATH
@go build -o $(GO_RPOMPT_BUILD_PATH) ./internal/prompt_app/prompt_app.go
else
@go build ./internal/prompt_app/prompt_app.go
endif
.PHONY: integration
integration: ## Run integration tests.
@pytest -v ./test/integration
.PHONY: help
help: ## Show help text
@echo "Commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'