-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (45 loc) · 1.18 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
# Go parameters
PROJECT_NAME := $(shell echo $${PWD\#\#*/})
PKG_LIST := $(shell go list ./...)
GO_FILES := $(shell find . -name '*.go' | grep -v _test.go)
.PHONY: all
all: lint install tags
.PHONY: install
install: ## Run install
@go install ./... && echo Installed `date` && echo
.PHONY: dep
dep:
@go get -u ./...
.PHONY: lintAll
lintAll: # run golangci-lint
@golangci-lint run
.PHONY: lint
lint: ## Run lint
@golangci-lint run --fast
.PHONY: test
test: ## Run unittests
@go test -short ${PKG_LIST}
.PHONY: race
race: ## Run data race detector
@go test -race -short ${PKG_LIST}
.PHONY: msan
msan: ## Run memory sanitizer
@go test -msan -short ${PKG_LIST}
.PHONY: build
build: ## Build the binary file
@go build -i -v
.PHONY: clean
clean: ## Remove previous build
@go clean ./...
.PHONY: linux
linux:
@env GOOS=linux GOARCH=amd64 go build -v -o $(CURDIR)/build/$(PROJECT_NAME)
.PHONY: lines
lines:
@find . -name "*.go" -exec wc -l {} \+
.PHONY: tags
tags:
@-find . -name '*.go' -exec gotags {} \+ > tags
.PHONY: help
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'