This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
forked from snowplow/snowplow-golang-tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (40 loc) · 1.82 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.PHONY: all format lint tidy test goveralls clean
# -----------------------------------------------------------------------------
# CONSTANTS
# -----------------------------------------------------------------------------
src_dir = tracker
build_dir = build
coverage_dir = $(build_dir)/coverage
coverage_out = $(coverage_dir)/coverage.out
coverage_html = $(coverage_dir)/coverage.html
# -----------------------------------------------------------------------------
# BUILDING
# -----------------------------------------------------------------------------
all:
CGO_ENABLED=0 GO111MODULE=on go build ./$(src_dir)
# -----------------------------------------------------------------------------
# FORMATTING
# -----------------------------------------------------------------------------
format:
CGO_ENABLED=0 GO111MODULE=on go fmt ./$(src_dir)
CGO_ENABLED=0 GO111MODULE=on gofmt -s -w ./$(src_dir)
lint:
CGO_ENABLED=0 GO111MODULE=on go get -u golang.org/x/lint/golint
CGO_ENABLED=0 GO111MODULE=on golint ./$(src_dir)
tidy:
CGO_ENABLED=0 GO111MODULE=on go mod tidy
# -----------------------------------------------------------------------------
# TESTING
# -----------------------------------------------------------------------------
test:
mkdir -p $(coverage_dir)
CGO_ENABLED=0 GO111MODULE=on go test ./$(src_dir) -tags test -v -covermode=count -coverprofile=$(coverage_out)
CGO_ENABLED=0 GO111MODULE=on go tool cover -html=$(coverage_out) -o $(coverage_html)
goveralls: test
CGO_ENABLED=0 GO111MODULE=on go get -u github.com/mattn/goveralls
CGO_ENABLED=0 GO111MODULE=on goveralls -coverprofile=$(coverage_out) -service=github
# -----------------------------------------------------------------------------
# CLEANUP
# -----------------------------------------------------------------------------
clean:
rm -rf $(build_dir)