forked from gaodoo/golang-restful-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
27 lines (20 loc) · 744 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
MAIN_VERSION:=$(shell git describe --abbrev=0 --tags || echo "0.1")
VERSION:=${MAIN_VERSION}\#$(shell git log -n 1 --pretty=format:"%h")
PACKAGES:=$(shell go list ./... | sed -n '1!p' | grep -v /vendor/)
LDFLAGS:=-ldflags "-X github.com/qiangxue/golang-restful-starter-kit/app.Version=${VERSION}"
default: run
depends:
../../../../bin/glide up
test:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES), \
go test -p=1 -cover -covermode=count -coverprofile=coverage.out ${pkg}; \
tail -n +2 coverage.out >> coverage-all.out;)
cover: test
go tool cover -html=coverage-all.out
run:
go run ${LDFLAGS} server.go
build: clean
go build ${LDFLAGS} -a -o server server.go
clean:
rm -rf server coverage.out coverage-all.out