-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (26 loc) · 769 Bytes
/
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
# Targets not related to individual files
.PHONY: all test cover_func cover_html out clean vet loc fmt test_v bench
# Build constants
BUILD_OUT_DIR = bin
TEST_COVERAGE_PROFILE = coverage.out
all: out fmt vet test_v loc
out:
mkdir -p $(BUILD_OUT_DIR)
fmt:
go fmt ./...
vet:
go vet ./...
test: out
go test -race ./... -coverprofile=$(BUILD_OUT_DIR)/$(TEST_COVERAGE_PROFILE)
test_v: out
go test -race -v ./... -coverprofile=$(BUILD_OUT_DIR)/$(TEST_COVERAGE_PROFILE)
bench:
go test -bench=.
loc:
find . -type f -not -path "./vendor/*" -name "*.go" | xargs wc -l
cover_func: test
go tool cover -func=$(BUILD_OUT_DIR)/$(TEST_COVERAGE_PROFILE)
cover_html: test
go tool cover -html=$(BUILD_OUT_DIR)/$(TEST_COVERAGE_PROFILE)
clean:
rm -rf $(BUILD_OUT_DIR)