-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
55 lines (36 loc) · 892 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
46
47
48
49
50
51
52
53
54
55
# add all your cmd/<things> in here
TARGETS = exodus-server exodus-client
CMD_DIR := ./cmd
PKG_DIR := ./pkg
OUT_DIR := ./out
COV_FILE := cover.out
GO111MODULE := on
GO_TEST_FLAGS := -v -count=1 -race -coverprofile=$(OUT_DIR)/$(COV_FILE) -covermode=atomic
.PHONY: $(OUT_DIR) clean build test mod cover test-deps fmt vet purge bench
all: clean mod fmt vet test build
$(OUT_DIR):
@mkdir -p $(OUT_DIR)
clean:
@rm -rf $(OUT_DIR)
purge: clean
go mod tidy
go clean -cache
go clean -testcache
go clean -modcache
build: $(OUT_DIR) mod
$(foreach target,$(TARGETS),go build -o $(OUT_DIR)/$(target) $(CMD_DIR)/$(target)/*.go;)
test: $(OUT_DIR)
go test $(GO_TEST_FLAGS) ./...
mod:
go mod tidy
go mod verify
cover:
go tool cover -html=$(OUT_DIR)/$(COV_FILE)
test-deps:
go test all
fmt:
go fmt ./...
vet:
go vet ./...
bench:
go test -bench=. -benchmem -benchtime=10s ./...