forked from ShiningRush/fastflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (25 loc) · 837 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
# must ensure your go version >= 1.16
.PHONY: install
install:
go install github.com/golang/mock/mockgen@v1.6.0
go install golang.org/x/tools/cmd/goimports@latest
.PHONY: tidy
tidy:
go mod tidy
@$(foreach dir,$(shell go list -f {{.Dir}} ./...),goimports -w $(dir);)
@$(foreach dir,$(shell go list -f {{.Dir}} ./...),gofmt -s -w $(dir);)
.PHONY: test
test:
go test -race -coverprofile=coverage.out ./...
# include integration tests
.PHONY: g-test
g-test:
go test -race -coverprofile=coverage.out ./... -tags=integration
# usage
# you must 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