Improve Makefile

pull/2/head 0.1.1
Vinícius Garcia 2021-06-06 12:15:38 -03:00
parent 936d387221
commit 54f5b7b1eb
1 changed files with 11 additions and 7 deletions

View File

@ -1,32 +1,36 @@
args= args=
path=./... path=./...
GOPATH=$(shell go env GOPATH) GOBIN=$(shell go env GOPATH)/bin
TIME=1s TIME=1s
test: setup test: setup
$(GOPATH)/bin/richgo test $(path) $(args) $(GOBIN)/richgo test $(path) $(args)
bench: bench:
go test -bench=. -benchtime=$(TIME) go test -bench=. -benchtime=$(TIME)
lint: setup lint: setup
@$(GOPATH)/bin/golint -set_exit_status -min_confidence 0.9 $(path) $(args) @$(GOBIN)/golint -set_exit_status -min_confidence 0.9 $(path) $(args)
@go vet $(path) $(args) @go vet $(path) $(args)
@echo "Golint & Go Vet found no problems on your code!" @echo "Golint & Go Vet found no problems on your code!"
mock: setup mock: setup
mockgen -package=exampleservice -source=contracts.go -destination=examples/example_service/mocks.go $(GOBIN)/mockgen -package=exampleservice -source=contracts.go -destination=examples/example_service/mocks.go
setup: .make.setup setup: $(GOBIN)/richgo $(GOBIN)/golint $(GOBIN)/mockgen
.make.setup:
$(GOBIN)/richgo:
go get github.com/kyoh86/richgo go get github.com/kyoh86/richgo
$(GOBIN)/golint:
go get golang.org/x/lint go get golang.org/x/lint
$(GOBIN)/mockgen:
@# (Gomock is used on examples/example_service) @# (Gomock is used on examples/example_service)
go get github.com/golang/mock/gomock go get github.com/golang/mock/gomock
go get github.com/golang/mock/mockgen go get github.com/golang/mock/mockgen
touch .make.setup
# Running examples: # Running examples:
exampleservice: mock exampleservice: mock