-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
29 lines (24 loc) · 809 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
WRAPPER_SUBMODULES := fasthttp gin gorestful
PWD := $(shell pwd)
DIR :=
# must ensure your go version >= 1.16
.PHONY: install
install:
go install github.com/golang/mock/[email protected]
go install golang.org/x/tools/cmd/goimports@latest
# usage
# you muse run `make install` to install necessary tools
# make mock dir=path/to/mock
.PHONY: mock
mock:
@for file in `find . -type d \( -path ./.git -o -path ./.github \) -prune -o -name '*.go' -print | xargs grep --files-with-matches -e '//go:generate mockgen'`; do \
go generate $$file; \
done
.PHONY: tidy
tidy:
go mod tidy && go fmt ./...
@$(foreach var,$(WRAPPER_SUBMODULES),cd $(PWD)/wrapper/$(var) && go mod tidy && go fmt ./...;)
.PHONY: test
test:
go test ./...
$(foreach var,$(WRAPPER_SUBMODULES),cd $(PWD)/wrapper/$(var) && go test ./...;)