From 8594d8edafc4102166fc79b0002c7108bc099f9c Mon Sep 17 00:00:00 2001 From: Eran Cohen Date: Mon, 19 Sep 2022 10:02:02 +0300 Subject: [PATCH] go 1.17 has deprecated installing executables with `go get` Use go install instead Set GOFLAGS to empty string to overcome the `cannot query module due to -mod=vendor` error we get in presubmit job --- Makefile | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 25fa8fd2..0273305f 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ envtest: ## Download envtest-setup locally if necessary. MOCKGEN = $(shell pwd)/bin/mockgen mockgen: ## Download mockgen locally if necessary. - $(call go-get-tool,$(MOCKGEN),github.com/golang/mock/mockgen) + $(call go-get-tool,$(MOCKGEN),github.com/golang/mock/mockgen@latest) GOLINT = $(shell pwd)/bin/golangci-lint golint: ## Download golangci-lint locally if necessary. @@ -172,12 +172,8 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) define go-get-tool @[ -f $(1) ] || { \ set -e ;\ -TMP_DIR=$$(mktemp -d) ;\ -cd $$TMP_DIR ;\ -go mod init tmp ;\ -echo "Downloading $(2)" ;\ -GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\ -rm -rf $$TMP_DIR ;\ +echo "Installing $(2)" ;\ +GOFLAGS="" GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\ } endef