forked from ureuzy/acos-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (23 loc) · 898 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
test: lint unit-test
lint: lint-bin ## Run go golangci-lint against code.
$(GOLANGCI_LINT) run
unit-test: mocks
go test -v ./... --vet=off -coverprofile cover.out
# Generate mocks
mocks: mockgen
$(MOCKGEN) -package mocks -source utils/http.go -destination pkg/mocks/mocks.go HttpClient
GOLANGCI_LINT = ./bin/golangci-lint
lint-bin: ## Download golangci-lint locally if necessary.
$(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/[email protected])
MOCKGEN = ./bin/mockgen
mockgen: ## Download mockgen locally if necessary.
$(call go-get-tool,$(MOCKGEN),github.com/golang/mock/[email protected])
# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
}
endef