-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
56 lines (41 loc) · 1.33 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
55
EXAMPLES=./examples/**/
BIN=bin/
PROXY=GOPROXY=proxy.golang.org
URI=github.com/ndaba1/gommander
ARTIFACTS=*.prof *.out *.bench *.exe
BENCH=.bench/
ifeq (, $(shell which golangci-lint))
$(warning "could not find golangci-lint in your PATH, run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
endif
ifeq (, $(shell which benchstat))
$(warning "could not find benchstat in your PATH. Is benchstat installed? If not, run: go install golang.org/x/perf/cmd/benchstat")
endif
all: test lint bench
fmt:
$(info *********** running format checks ***********)
go fmt
test:
$(info *********** running tests ***********)
go test
bench:
$(info *********** running benches ***********)
go test --bench=.
lint:
$(info *********** running linting ***********)
golangci-lint run
release:
$(GOPROXY) go list -m $(URI)@$(VERSION)
coverage:
$(info *********** checking coverage ***********)
go test -coverprofile=coverage.out
reports: coverage
go tool cover -html=coverage.out
benchcmp:
$(info *********** comparing benches ***********)
benchstat $(BENCH)old.bench $(BENCH)latest.bench
examples: $(EXAMPLES)
$(info *********** generating example binaries ***********)
go build -o $(BIN) $(EXAMPLES)
clean:
$(info *********** cleaning build and test artifacts ***********)
$(RM) -r $(BIN) $(ARTIFACTS) $(BENCH)