From 6789d4e63750e5f2603dd5974cfd82e75ec3b301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Fri, 27 Jan 2017 20:31:17 +0200 Subject: [PATCH] Workaround that we have two GOROOTs; we have to set the path for the go executable to EDGE_GOROOT/bin/go when using the edge version --- hack/lib/golang.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 08a64553cff..8e57e6915fd 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -505,7 +505,13 @@ kube::golang::build_binaries_for_platform() { local -a nonstatics=() local -a tests=() - V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}" + # Temporary workaround while we have two GOROOT's (which we'll get rid of as soon as we upgrade to go1.8 for amd64 as well) + local GO=go + if [[ "${GOROOT}" == "${K8S_EDGE_GOROOT:-}" ]]; then + GO="${K8S_EDGE_GOROOT}/bin/go" + fi + + V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-} GO=${GO}" for binary in "${binaries[@]}"; do @@ -526,7 +532,7 @@ kube::golang::build_binaries_for_platform() { kube::log::progress " " for binary in "${statics[@]:+${statics[@]}}"; do local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}") - CGO_ENABLED=0 go build -o "${outfile}" \ + CGO_ENABLED=0 "${GO}" build -o "${outfile}" \ "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \ @@ -535,7 +541,7 @@ kube::golang::build_binaries_for_platform() { done for binary in "${nonstatics[@]:+${nonstatics[@]}}"; do local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}") - go build -o "${outfile}" \ + "${GO}" build -o "${outfile}" \ "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \ @@ -546,13 +552,13 @@ kube::golang::build_binaries_for_platform() { else # Use go install. if [[ "${#nonstatics[@]}" != 0 ]]; then - go install "${goflags[@]:+${goflags[@]}}" \ + "${GO}" install "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \ "${nonstatics[@]:+${nonstatics[@]}}" fi if [[ "${#statics[@]}" != 0 ]]; then - CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \ + CGO_ENABLED=0 "${GO}" install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \ "${statics[@]:+${statics[@]}}" @@ -585,13 +591,13 @@ kube::golang::build_binaries_for_platform() { # doing a staleness check on k8s.io/kubernetes/test/e2e package always # returns true (always stale). And that's why we need to install the # test package. - go install "${goflags[@]:+${goflags[@]}}" \ + "${GO}" install "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \ "${testpkg}" mkdir -p "$(dirname ${outfile})" - go test -i -c \ + "${GO}" test -i -c \ "${goflags[@]:+${goflags[@]}}" \ -gcflags "${gogcflags}" \ -ldflags "${goldflags}" \