-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (39 loc) · 1.21 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
# Default Go binary.
ifndef GOROOT
GOROOT = /usr/local/go
endif
# Determine the OS to build.
ifeq ($(OS),)
ifeq ($(shell uname -s), Darwin)
GOOS = darwin
else
GOOS = linux
endif
else
GOOS = $(OS)
endif
# Allow optional arguments for `proto-gen`
ifeq (proto-gen, $(firstword $(MAKECMDGOALS)))
runargs := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(runargs):;@true)
endif
GOCMD = GOOS=$(GOOS) go
GOTEST = $(GOCMD) test -race
GO_PKGS?=$$(go list ./... | grep -v /vendor/)
# See golangci.yml in extra folder for linters setup
linter: ## Run linter
@golangci-lint run -c golangci.yml ./...;
@cd sdlc/codegen && golangci-lint run --path-prefix="sdlc/codegen" -c ../../golangci.yml ./...;
## Generate Go code (pb, grpc and grpc-gateway) of our api
# Supports optional name of directory for which to run the command. E.g.
# make proto-gen b2c
proto-gen:
@if [ -z $(filter-out $@,$(MAKECMDGOALS)) ]; then \
cd protocol && buf generate; \
else \
cd protocol && buf generate --path $(runargs); \
fi
test: ## Run unit test (without integration tests)
$(GOTEST) -v $(GO_PKGS)
bench: ## Run go benchmarks
$(GOCMD) test -tags integration -bench=. ./... -benchmem