-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
32 lines (25 loc) · 1.02 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
.PHONY: help test deps
# Ref: https://gist.github.com/prwhite/8168133
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
GOMOCK_VERSION = "v1.5.0"
gomock: ## go generate mock file.
go install "github.com/golang/mock/mockgen@$(GOMOCK_VERSION)"
go list ./... |grep -v '/gomock' | xargs go generate -v
header: ## check and add license header.
sh addlicense.sh
lint: ## run lint
ifeq (, $(shell which golangci-lint))
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.51.2
else
echo "Found golangci-lint"
endif
golangci-lint run ./...
test: header lint ## Run test cases.
go install "github.com/rakyll/[email protected]"
gotest -v -race -coverprofile=coverage.out -covermode=atomic ./...
deps: ## Update vendor.
go mod verify
go mod tidy -v