forked from Dataman-Cloud/swan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (27 loc) · 815 Bytes
/
Makefile
File metadata and controls
35 lines (27 loc) · 815 Bytes
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
PACKAGES = $(shell go list ./...)
.PHONY: build fmt test test-cover-html test-cover-func collect-cover-data
# Prepend our vendor directory to the system GOPATH
# so that import path resolution will prioritize
# our third party snapshots.
export GO15VENDOREXPERIMENT=1
# GOPATH := ${PWD}/vendor:${GOPATH}
# export GOPATH
default: build
build: fmt
go build -v -o swan .
fmt:
go fmt ./...
test:
go test -cover=true ./...
collect-cover-data:
@echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -v -coverprofile=coverage.out -covermode=count $(pkg) || exit $$?;\
if [ -f coverage.out ]; then\
tail -n +2 coverage.out >> coverage-all.out;\
fi\
;)
test-cover-html:
go tool cover -html=coverage-all.out -o coverage.html
test-cover-func:
go tool cover -func=coverage-all.out