-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (48 loc) · 1.14 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
59
60
61
62
63
64
65
66
67
68
69
70
-include .env
PROJECT = $(shell basename -s .git $(shell git config --get remote.origin.url))
.PHONY: init generate build clean tidy update sync check test coverage benchmark lint fmt vet doc
all: lint test build
init:
@$(MAKE) install-tools
@$(MAKE) install-modules
install-tools:
@go install golang.org/x/tools/cmd/godoc@latest
@go install golang.org/x/tools/cmd/goimports@latest
@go install honnef.co/go/tools/cmd/staticcheck@latest
install-modules:
@go install -v ./...
generate:
@go generate ./...
build:
@go clean -cache
@mkdir -p dist
@go build -ldflags "-s -w" -o ./dist/$(PROJECT) ./cmd/...
clean:
@go clean -cache
@rm -rf dist
tidy:
@go mod tidy
update:
@go get -u all
clean-sum:
@rm go.sum
clean-cache:
@go clean -modcache
sync:
@go work sync
check: lint test staticcheck
test:
@go test -race $(test-options) ./...
coverage:
@go test -race --coverprofile=coverage.out --covermode=atomic $(test-options) ./...
benchmark:
@go test -run="-" -bench=".*" -benchmem $(test-options) ./...
lint: fmt vet staticcheck
fmt:
@goimports -w .
vet:
@go vet ./...
staticcheck:
@staticcheck ./...
doc: init
@godoc -http=:6060