-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
54 lines (43 loc) · 1.05 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
SHELL := /bin/bash
GO_BUILD_OPTION := -trimpath -tags netgo
.PHONY: all check format vet build clean test generate
help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " check to format and vet"
@echo " build to create bin directory and build noah"
@echo " clean to clean build and test files"
@echo " test to run test"
check: format vet
format:
@echo "go fmt"
@go fmt ./...
@echo "ok"
vet:
@echo "go vet"
@go vet ./...
@echo "ok"
setup:
go install github.com/golang/protobuf/protoc-gen-go
go get google.golang.org/grpc/cmd/[email protected]
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
generate:
@echo "generate code..."
@go generate ./...
@echo "Done"
build: tidy setup generate check
@echo "build noah"
@go build ${GO_BUILD_OPTION} -race ./...
@echo "ok"
clean:
@rm -rf ./bin
@rm -rf ./release
@rm -rf ./coverage
test:
@echo "run test"
@go test -race -v -count=1 ./task
@echo "ok"
tidy:
@echo "Tidy and check the go mod files"
@go mod tidy
@go mod verify
@echo "Done"