-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (36 loc) · 1.07 KB
/
Copy pathMakefile
File metadata and controls
43 lines (36 loc) · 1.07 KB
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
# This is the Go package to run a target against. Useful for running tests of one package, for example.
PACKAGE ?= ./...
# We want to have our binaries in the bin subdirectory available. In addition we want them to have priority over
# binaries somewhere else on the system.
export PATH := $(CURDIR)/bin:$(PATH)
.PHONY: all
all: build
.PHONY: build
build: prepare
go build ./cmd/membership
go build ./examples/demo
go build ./examples/simple
.PHONY: test
test: prepare
rm -rf tmp/coverage
mkdir -p tmp/coverage
go test --race -coverpkg=./... -cover $(PACKAGE) -args -test.gocoverdir=$(CURDIR)/tmp/coverage
@echo
@echo "========== Corrected coverage over all packages =========="
go tool covdata percent -i=tmp/coverage
go tool covdata textfmt -i=tmp/coverage -o tmp/cover.out
go tool cover -html=tmp/cover.out -o tmp/cover.html
.PHONY: benchmark
benchmark: prepare
go test -run=^$$ -bench=. -benchmem $(PACKAGE)
.PHONY: prepare
prepare:
go mod tidy
go fmt $(PACKAGE)
go vet $(PACKAGE)
golangci-lint run --fix
.PHONY: clean
clean:
rm -rf tmp
rm -f demo
rm -f membership