-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (27 loc) · 1.03 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
MAIN_VERSION:=$(shell git describe --abbrev=0 --tags || echo "0.1.0")
VERSION:=${MAIN_VERSION}
PACKAGES:=$(shell go list ./... | sed -n '1!p' | grep -v './vendor')
PACKAGE_WITHOUT_E2E:=$(shell go list ./... | sed -n '1!p' | grep -v -E '(./vendor|./testdata|./daos|./apis)')
LDFLAGS:=-ldflags "-X github.com/ederavilaprado/golang-web-architecture-template/app.Version=${VERSION}"
default: test
deps:
go get -v github.com/stretchr/testify/assert
go get -v .
test:
go test -v -p=1 $(PACKAGES)
unit-test:
go test -v $(PACKAGE_WITHOUT_E2E)
cover:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES), \
go test -v -p=1 -cover -covermode=count -coverprofile=coverage.out ${pkg}; \
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out
run:
go run ${LDFLAGS} main.go
dev:
CompileDaemon -exclude-dir ".git" -color -build "go build -o _build_hot_reload" -command "./_build_hot_reload"
build: clean
go build ${LDFLAGS} -a -o server main.go
clean:
rm -rf _build_hot_reload coverage.out coverage-all.out