-
Notifications
You must be signed in to change notification settings - Fork 815
/
Copy pathMakefile
44 lines (32 loc) · 1.04 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
MAIN_PACKAGE_PATH := ./cmd/asdf
TARGET_DIR := .
TARGET := asdf
# Because this Makefile isn't used as part of the actual release binary build,
# It sets FULL_VERSION to a dev version containing the SHA of the current
# commit. If we ever use this Makefile to generate release binaries this code
# will need to change.
FULL_VERSION = "$(shell git rev-parse --short HEAD)-dev"
LINKER_FLAGS = '-s -X main.version=${FULL_VERSION}'
# Not sure what the default location should be for builds
build: # test lint
go build -ldflags=${LINKER_FLAGS} -o=${TARGET_DIR}/${TARGET} ${MAIN_PACKAGE_PATH}
fmt:
go fmt ./...
go run mvdan.cc/gofumpt -l -w .
verify:
go mod verify
tidy:
go mod tidy -v
audit: verify vet test
test:
go test -coverprofile=/tmp/coverage.out -bench= -race ./...
cover: test
go tool cover -html=/tmp/coverage.out
lint: fmt
go run honnef.co/go/tools/cmd/staticcheck -tests -show-ignored ./...
go run github.com/mgechev/revive -set_exit_status ./...
vet: fmt
go vet ./...
run: build
${TARGET_DIR}/${TARGET}
.PHONY: fmt lint vet build test run