-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (48 loc) · 985 Bytes
/
Copy pathMakefile
File metadata and controls
60 lines (48 loc) · 985 Bytes
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
BINARY := md2
BIN_DIR := bin
PKG := ./...
.DEFAULT_GOAL := help
## help: list available targets
.PHONY: help
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' | awk -F': ' '{printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
## build: compile the binary into bin/
.PHONY: build
build:
@mkdir -p $(BIN_DIR)
go build -o $(BIN_DIR)/$(BINARY) .
## run: build and run (pass args via ARGS="...")
.PHONY: run
run:
go run . $(ARGS)
## install: install the binary into GOBIN/GOPATH
.PHONY: install
install:
go install .
## test: run all tests
.PHONY: test
test:
go test $(PKG)
## cover: run tests with coverage summary
.PHONY: cover
cover:
go test -cover $(PKG)
## fmt: format all Go source
.PHONY: fmt
fmt:
go fmt $(PKG)
## vet: run go vet
.PHONY: vet
vet:
go vet $(PKG)
## tidy: sync go.mod / go.sum
.PHONY: tidy
tidy:
go mod tidy
## check: fmt, vet, and test
.PHONY: check
check: fmt vet test
## clean: remove build artifacts
.PHONY: clean
clean:
rm -rf $(BIN_DIR)