forked from skycoin/teller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (33 loc) · 1.62 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
.DEFAULT_GOAL := help
.PHONY: teller test lint lint-fast check format cover help
PACKAGES = $(shell find ./src -type d -not -path '\./src')
teller: ## Run teller. To add arguments, do 'make ARGS="--foo" teller'.
go run cmd/teller/teller.go ${ARGS}
test: ## Run tests
go test ./cmd/... -timeout=1m -cover
go test ./src/... -timeout=1m -cover
lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
gometalinter --deadline=2m --disable-all -E goimports -E unparam --tests --vendor ./...
lint-fast: ## Run linters. Use make install-linters first. Skips slow linters.
vendorcheck ./...
gometalinter --disable-all -E goimports --tests --vendor ./...
check: lint test ## Run tests and linters
cover: ## Runs tests on ./src/ with HTML code coverage
@echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -coverprofile=coverage.out $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out
install-linters: ## Install linters
go get -u github.com/FiloSottile/vendorcheck
go get -u github.com/alecthomas/gometalinter
gometalinter --vendored-linters --install
format: # Formats the code. Must have goimports installed (use make install-linters).
# This sorts imports by [stdlib, 3rdpart, skycoin/skycoin, skycoin/teller]
goimports -w -local github.com/skycoin/teller ./cmd
goimports -w -local github.com/skycoin/teller ./src
goimports -w -local github.com/skycoin/skycoin ./cmd
goimports -w -local github.com/skycoin/skycoin ./src
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'