Set GOCACHE and GOMODCACHE

If these are not set, set them.  This ensures that any subsequent
scripts we call (which may call setup_env again) use the same values.
This commit is contained in:
Tim Hockin 2023-01-19 18:30:09 -08:00
parent 965d5d8608
commit 7c262b901f
No known key found for this signature in database

View File

@ -521,7 +521,10 @@ kube::golang::setup_env() {
kube::golang::create_gopath_tree kube::golang::create_gopath_tree
export GOPATH="${KUBE_GOPATH}" export GOPATH="${KUBE_GOPATH}"
export GOCACHE="${KUBE_GOPATH}/cache" # If these are not set, set them now. This ensures that any subsequent
# scripts we run (which may call this function again) use the same values.
export GOCACHE="${GOCACHE:-"${KUBE_GOPATH}/cache/build"}"
export GOMODCACHE="${GOMODCACHE:-"${KUBE_GOPATH}/cache/mod"}"
# Make sure our own Go binaries are in PATH. # Make sure our own Go binaries are in PATH.
export PATH="${KUBE_GOPATH}/bin:${PATH}" export PATH="${KUBE_GOPATH}/bin:${PATH}"