Use -mod=vendor for most go commands

Without this set, go 1.13 was redownloading all dependencies into the module cache, effectively ignoring the vendor directory.

This instructs go 1.13 to always use (and verify the contents of) the vendor directory.

See an example prow job here: https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/kops/9389/pull-kops-verify-govet/1273460433402990595

All of the `go: downloading` and `go: extracting` lines indicate its downloading those dependencies rather than using the vendor directory.
This commit is contained in:
Peter Rifel 2020-06-18 07:15:19 -05:00
parent e7d5d323bf
commit e42431ff06
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
1 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,9 @@ BAZEL_CONFIG?=
API_OPTIONS?=
GCFLAGS?=
# This can be removed when we upgrade to go 1.14
export GOFLAGS=-mod=vendor
UPLOAD_CMD=$(KOPS_ROOT)/hack/upload
# Unexport environment variables that can affect tests and are not used in builds
@ -460,6 +463,7 @@ gomod-prereqs:
(which bazel > /dev/null) || (echo "gomod requires that bazel is installed"; exit 1)
.PHONY: gomod
gomod: export GOFLAGS=
gomod: gomod-prereqs
GO111MODULE=on go mod vendor
# Switch weavemesh to use peer_name_hash - bazel rule-go doesn't support build tags yet