-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
58 lines (46 loc) · 1.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
GO_CMD=go
GO_TEST=${GO_CMD} test
GO_BUILD=${GO_CMD} build
RELEASER_CMD=goreleaser
RELEASE=${RELEASER_CMD} release
LINTER_CMD=golangci-lint
LINT=${LINTER_CMD} run
BINARY_NAME=gremlins
COVER_OUT=coverage.out
TARGET=dist
BIN=${TARGET}/bin
.PHONY: all snap
all: lint test build
snap: lint test snapshot
build: ${BIN}/${BINARY_NAME}
${BIN}/${BINARY_NAME}:
mkdir -p ${BIN}
${GO_BUILD} -o ${BIN}/${BINARY_NAME} cmd/gremlins/main.go
.PHONY: test
test:
${GO_TEST} -race ./...
.PHONY: cover
cover: ${COVER_OUT}
${COVER_OUT}:
${GO_TEST} -race -covermode=atomic -cover -coverprofile ${COVER_OUT} ./...
.PHONY: requirements
requirements:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
.PHONY: lint
lint:
${LINT} ./...
.PHONY: goimports
goimports:
goimports --local 'github.com/go-gremlins/gremlins' -v -w .
.PHONY: fieldalignment
fieldalignment:
fieldalignment -fix ./...
.PHONY: snapshot
snapshot:
${RELEASE} --snapshot --clean
.PHONY: clean
clean:
go clean
rm -rf -- ${TARGET}
rm -f -- coverage.out