diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 3437414e2e2..bd4be75a6ca 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -582,8 +582,9 @@ kube::golang::setup_env() { # Cross-compiles will not work with it set. unset GOBIN - # Explicitly turn on modules. - export GO111MODULE=on + # Turn on modules and workspaces (both are default-on). + unset GO111MODULE + unset GOWORK # This may try to download our specific Go version. Do it last so it uses # the above-configured environment. diff --git a/hack/lint-dependencies.sh b/hack/lint-dependencies.sh index 7ea765d55e3..404ebeede0e 100755 --- a/hack/lint-dependencies.sh +++ b/hack/lint-dependencies.sh @@ -25,10 +25,6 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" -# Set the Go environment, otherwise we get "can't compute 'all' using the -# vendor directory". -export GOWORK=off -export GOFLAGS=-mod=mod # Detect problematic GOPROXY settings that prevent lookup of dependencies if [[ "${GOPROXY:-}" == "off" ]]; then kube::log::error "Cannot run with \$GOPROXY=off" @@ -38,6 +34,11 @@ fi kube::golang::setup_env kube::util::require-jq +# Set the Go environment, otherwise we get "can't compute 'all' using the +# vendor directory". +export GOWORK=off +export GOFLAGS=-mod=mod + # let us log all errors before we exit rc=0 diff --git a/hack/pin-dependency.sh b/hack/pin-dependency.sh index 37984b82a06..35d37439794 100755 --- a/hack/pin-dependency.sh +++ b/hack/pin-dependency.sh @@ -25,17 +25,18 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" +# Detect problematic GOPROXY settings that prevent lookup of dependencies +if [[ "${GOPROXY:-}" == "off" ]]; then + kube::log::error "Cannot run with \$GOPROXY=off" + exit 1 +fi + kube::golang::setup_env kube::util::require-jq # Explicitly set GOFLAGS to ignore vendor, since GOFLAGS=-mod=vendor breaks dependency resolution while rebuilding vendor export GOWORK=off export GOFLAGS=-mod=mod -# Detect problematic GOPROXY settings that prevent lookup of dependencies -if [[ "${GOPROXY:-}" == "off" ]]; then - kube::log::error "Cannot run with \$GOPROXY=off" - exit 1 -fi dep="${1:-}" sha="${2:-}" diff --git a/test/e2e/dra/README.md b/test/e2e/dra/README.md index 5b1ca93865d..a640c738b71 100644 --- a/test/e2e/dra/README.md +++ b/test/e2e/dra/README.md @@ -41,8 +41,6 @@ $ kind create cluster --config test/e2e/dra/kind.yaml --image dra/node:latest - Build ginkgo -> NB: If you are using go workspace you must disable it `GOWORK=off make ginkgo` - ```bash $ make ginkgo ```