-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
39 lines (30 loc) · 1.04 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
PACKAGES = $(shell go list ./...)
test-all: vet lint test
test:
go test -v -parallel=8 ${PACKAGES}
test-race:
go test -v -race ${PACKAGES}
vet:
go vet ${PACKAGES}
lint:
@go install golang.org/x/lint/golint@latest
go list ./... | grep -v vendor | xargs -n1 golint
cover:
go test -coverprofile=cover.out
go tool cover -html cover.out -o coverage.html
@which xdg-open &> /dev/null && xdg-open coverage.html || open coverage.html || echo "No way to open coverage.html automatically found."
@sleep 1
@rm -f cover.out coverage.html
explain:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " test - Test the package code."
@echo " test-all - Test, lint and vet the package code."
@echo " test-race - Test race conditions."
@echo " cover - Run the go test coverage tool."
@echo " lint - Run golint on the package code."
@echo " vet - Run go vet."
@echo " explain - Display this help message."
.PHONY: test-all test test-race vet lint cover
.DEFAULT_GOAL := explain