mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-20 01:01:22 +00:00
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
This commit is contained in:
parent
84006601a0
commit
6789d4e637
@ -505,7 +505,13 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
local -a nonstatics=()
|
local -a nonstatics=()
|
||||||
local -a tests=()
|
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
|
for binary in "${binaries[@]}"; do
|
||||||
|
|
||||||
@ -526,7 +532,7 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
kube::log::progress " "
|
kube::log::progress " "
|
||||||
for binary in "${statics[@]:+${statics[@]}}"; do
|
for binary in "${statics[@]:+${statics[@]}}"; do
|
||||||
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
|
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[@]}}" \
|
"${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
@ -535,7 +541,7 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
done
|
done
|
||||||
for binary in "${nonstatics[@]:+${nonstatics[@]}}"; do
|
for binary in "${nonstatics[@]:+${nonstatics[@]}}"; do
|
||||||
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
|
local outfile=$(kube::golang::output_filename_for_binary "${binary}" "${platform}")
|
||||||
go build -o "${outfile}" \
|
"${GO}" build -o "${outfile}" \
|
||||||
"${goflags[@]:+${goflags[@]}}" \
|
"${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
@ -546,13 +552,13 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
else
|
else
|
||||||
# Use go install.
|
# Use go install.
|
||||||
if [[ "${#nonstatics[@]}" != 0 ]]; then
|
if [[ "${#nonstatics[@]}" != 0 ]]; then
|
||||||
go install "${goflags[@]:+${goflags[@]}}" \
|
"${GO}" install "${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
"${nonstatics[@]:+${nonstatics[@]}}"
|
"${nonstatics[@]:+${nonstatics[@]}}"
|
||||||
fi
|
fi
|
||||||
if [[ "${#statics[@]}" != 0 ]]; then
|
if [[ "${#statics[@]}" != 0 ]]; then
|
||||||
CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \
|
CGO_ENABLED=0 "${GO}" install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
"${statics[@]:+${statics[@]}}"
|
"${statics[@]:+${statics[@]}}"
|
||||||
@ -585,13 +591,13 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
# doing a staleness check on k8s.io/kubernetes/test/e2e package always
|
# 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
|
# returns true (always stale). And that's why we need to install the
|
||||||
# test package.
|
# test package.
|
||||||
go install "${goflags[@]:+${goflags[@]}}" \
|
"${GO}" install "${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
"${testpkg}"
|
"${testpkg}"
|
||||||
|
|
||||||
mkdir -p "$(dirname ${outfile})"
|
mkdir -p "$(dirname ${outfile})"
|
||||||
go test -i -c \
|
"${GO}" test -i -c \
|
||||||
"${goflags[@]:+${goflags[@]}}" \
|
"${goflags[@]:+${goflags[@]}}" \
|
||||||
-gcflags "${gogcflags}" \
|
-gcflags "${gogcflags}" \
|
||||||
-ldflags "${goldflags}" \
|
-ldflags "${goldflags}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user