mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Merge pull request #124195 from bart0sh/PR139-use-downloaded-go-to-place-binaries
hacks: build main target without go in the PATH
This commit is contained in:
commit
f5f8db0faf
@ -635,6 +635,7 @@ kube::golang::place_bins() {
|
||||
ln -s "${KUBE_OUTPUT_BIN}/${platform}" "${THIS_PLATFORM_BIN}"
|
||||
fi
|
||||
|
||||
V=3 kube::log::status "Placing binaries for ${platform} in ${KUBE_OUTPUT_BIN}/${platform}"
|
||||
local full_binpath_src="${KUBE_GOPATH}/bin${platform_src}"
|
||||
if [[ -d "${full_binpath_src}" ]]; then
|
||||
mkdir -p "${KUBE_OUTPUT_BIN}/${platform}"
|
||||
@ -795,7 +796,7 @@ kube::golang::build_binaries_for_platform() {
|
||||
fi
|
||||
done
|
||||
|
||||
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
|
||||
V=2 kube::log::info "Env for ${platform}: GOPATH=${GOPATH-} GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
|
||||
V=3 kube::log::info "Building binaries with GCFLAGS=${gogcflags} LDFLAGS=${goldflags}"
|
||||
|
||||
local -a build_args
|
||||
@ -873,10 +874,6 @@ kube::golang::get_physmem() {
|
||||
# KUBE_BUILD_PLATFORMS - Incoming variable of targets to build for. If unset
|
||||
# then just the host architecture is built.
|
||||
kube::golang::build_binaries() {
|
||||
# Create a sub-shell so that we don't pollute the outer environment
|
||||
(
|
||||
# Check for `go` binary and set ${GOPATH}.
|
||||
kube::golang::setup_env
|
||||
V=2 kube::log::info "Go version: $(GOFLAGS='' go version)"
|
||||
|
||||
local host_platform
|
||||
@ -964,7 +961,7 @@ kube::golang::build_binaries() {
|
||||
cat "/tmp//${platform//\//_}.build"
|
||||
done
|
||||
|
||||
exit "${fails}"
|
||||
return "${fails}"
|
||||
else
|
||||
for platform in "${platforms[@]}"; do
|
||||
kube::log::status "Building go targets for ${platform}"
|
||||
@ -974,5 +971,4 @@ kube::golang::build_binaries() {
|
||||
)
|
||||
done
|
||||
fi
|
||||
)
|
||||
}
|
||||
|
@ -24,5 +24,6 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||
KUBE_VERBOSE="${KUBE_VERBOSE:-1}"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
kube::golang::build_binaries "$@"
|
||||
kube::golang::place_bins
|
||||
|
Loading…
Reference in New Issue
Block a user