-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (31 loc) · 883 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
39
40
41
42
43
44
45
BINARY=notes
BUILD=$$(vtag)
REVISION=`git rev-list -n1 HEAD`
BUILDTAGS=
LDFLAGS=--ldflags "-X main.Version=${BUILD} -X main.Revision=${REVISION} -X \"main.BuildTags=${BUILDTAGS}\""
DEV_BUILDTAGS= debug
space=$(eval) #
comma=,
default: all
all: test build
build: format
go build ${LDFLAGS} -o ${BINARY} -v ./cmd/notes
dev-build: BUILDTAGS=$(subst $(space),$(comma),$(DEV_BUILDTAGS))
dev-build: format
go build -tags "${BUILDTAGS}" ${LDFLAGS} -o ${BINARY} -v ./cmd/notes
docker: format
docker build --network=host --tag "${BINARY}:dev-latest" -f Dockerfile .
test:
gotest --race ./...
dev-test: BUILDTAGS=$(subst $(space),$(comma),$(DEV_BUILDTAGS))
dev-test:
gotest --race --count=1 -v -tags "${BUILDTAGS}" ./...
format fmt:
gofmt -l -w .
clean:
go mod tidy
go clean
rm $(BINARY)
get-tag:
echo ${BUILD}
.PHONY: all build dev-build test format fmt clean get-tag