-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (40 loc) · 999 Bytes
/
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
GO111MODULE=on
BINARY_NAME=nats-logger
BINARY_NAME_CROSS_LINUX=nats-logger
RIMRAF=rm -rf
PACKAGE_NAME=go.sirus.dev/nats-logger
# setup OS variables
ifeq ($(OS), Windows_NT)
BINARY_NAME=nats-logger.exe
endif
.PHONY: all test docs
all:
make init
make build
init:
make clean
make install-dependency
build:
go build -o $(BINARY_NAME) -v
run:
go run $(PACKAGE_NAME)
help:
go run $(PACKAGE_NAME) help
lint:
revive -config revive.toml -formatter stylish $(PACKAGE_NAME) pkg/...
test:
ginkgo -cover -outputdir=./coverage ./...
merge-coverage:
@for f in `find . -name \*.coverprofile`; do tail -n +2 $$f >>_total; done
@echo 'mode: atomic' >total.coverprofile
@awk -f merge-profiles.awk <_total >>total.coverprofile
build-cross-linux:
make init
make lint
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BINARY_NAME_CROSS_LINUX) -v
install-dependency:
go get -v github.com/mgechev/revive
go get -v github.com/onsi/ginkgo/ginkgo
go mod tidy
clean:
$(RIMRAF) $(BINARY_NAME)