diff --git a/Makefile b/Makefile index f1b1a25..fcb8272 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +GOBIN = go CGO_ENABLED = 0 # Strip binaries by default to make them smaller. GO_LDFLAGS = -s -w @@ -5,7 +6,7 @@ GO_LDFLAGS = -s -w # static binaries. GO_BUILD_ARGS = -v -tags "netgo" -trimpath -GOPATH = `go env GOPATH` +GOPATH = `$(GOBIN) env GOPATH` ADDLICENSE = $(GOPATH)/bin/addlicense ADDLICENSE_ARGS = -v -s=only -l=apache -c "RStudio, PBC" -ignore 'coverage*' -ignore '.github/**' -ignore '.goreleaser.yaml' NOTICETOOL = $(GOPATH)/bin/go-licence-detector @@ -14,7 +15,7 @@ all: rskey .PHONY: rskey rskey: - GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) go build \ + GO111MODULE=on CGO_ENABLED=$(CGO_ENABLED) $(GOBIN) build \ -ldflags="$(GO_LDFLAGS)" $(GO_BUILD_ARGS) -o $@ ./$< .PHONY: static-build @@ -25,18 +26,18 @@ check: fmt vet .PHONY: test test: - GO111MODULE=on go test ./... $(GO_BUILD_ARGS) -coverprofile coverage.out - go tool cover -html=coverage.out -o coverage.html - GO111MODULE=on go test ./... $(GO_BUILD_ARGS) -tags "fips" -coverprofile coverage-fips.out - go tool cover -html=coverage-fips.out -o coverage-fips.html + GO111MODULE=on $(GOBIN) test ./... $(GO_BUILD_ARGS) -coverprofile coverage.out + $(GOBIN) tool cover -html=coverage.out -o coverage.html + GO111MODULE=on $(GOBIN) test ./... $(GO_BUILD_ARGS) -tags "fips" -coverprofile coverage-fips.out + $(GOBIN) tool cover -html=coverage-fips.out -o coverage-fips.html .PHONY: fmt fmt: - GO111MODULE=on go fmt ./... + GO111MODULE=on $(GOBIN) fmt ./... .PHONY: vet vet: - GO111MODULE=on go vet ./... + GO111MODULE=on $(GOBIN) vet ./... .PHONY: check-license check-license: