-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
58 lines (44 loc) · 1 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
56
57
58
LANG := en_US.UTF-8
SHELL := /bin/bash
.SHELLFLAGS := --norc --noprofile -e -u -o pipefail -c
.DEFAULT_GOAL := build
name := kkn.fi/vanity
GOIMPORTS := $(GOPATH)/bin/goimports
STATICCHECK := $(GOPATH)/bin/staticcheck
.PHONY: build
build:
go build $(name)
.PHONY: test
test: test-unit test-integration
.PHONY: test-unit
test-unit:
go test -v -short $(name)
.PHONY: test-integration
test-integration:
go test -v $(name)
$(GOIMPORTS):
go install golang.org/x/tools/cmd/goimports@latest
$(STATICCHECK):
go install honnef.co/go/tools/cmd/staticcheck@latest
.PHONY: fmt
fmt:
gofmt -w -s .
.PHONY: goimports
goimports: fmt $(GOIMPORTS)
$(GOIMPORTS) -w .
.PHONY: staticcheck
staticcheck: $(STATICCHECK)
$(STATICCHECK) ./...
.PHONY: cover
cover:
go test -coverprofile=coverage.out $(name)/...
go tool cover -html=coverage.out
@$(RM) -f coverage.out
.PHONY: heat
heat:
go test -covermode=count -coverprofile=count.out $(name)/...
go tool cover -html=count.out
@$(RM) -f count.out
.PHONY: clean
clean:
go clean