Skip to content

Commit 8594d8e

Browse files
committed
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
1 parent e6fa01e commit 8594d8e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Makefile

+3-7
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ envtest: ## Download envtest-setup locally if necessary.
161161

162162
MOCKGEN = $(shell pwd)/bin/mockgen
163163
mockgen: ## Download mockgen locally if necessary.
164-
$(call go-get-tool,$(MOCKGEN),github.com/golang/mock/mockgen)
164+
$(call go-get-tool,$(MOCKGEN),github.com/golang/mock/mockgen@latest)
165165

166166
GOLINT = $(shell pwd)/bin/golangci-lint
167167
golint: ## Download golangci-lint locally if necessary.
@@ -172,12 +172,8 @@ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
172172
define go-get-tool
173173
@[ -f $(1) ] || { \
174174
set -e ;\
175-
TMP_DIR=$$(mktemp -d) ;\
176-
cd $$TMP_DIR ;\
177-
go mod init tmp ;\
178-
echo "Downloading $(2)" ;\
179-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
180-
rm -rf $$TMP_DIR ;\
175+
echo "Installing $(2)" ;\
176+
GOFLAGS="" GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
181177
}
182178
endef
183179

0 commit comments

Comments
 (0)