From c85ac59df4173892270dd5e082e66a6812c7ad56 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Mon, 9 Jun 2025 14:42:44 -0400 Subject: [PATCH] Build k8s using latest commit of golang Run "gimme master" and use the newly built binaries. Adjust GOROOT_BOOTSTRAP so we can use the golang that is already on disk to build the new commit from golang. To enable this, edit `.go-version` and set the version to ``` devel ``` and then run `make quick-release` (for example) Signed-off-by: Davanum Srinivas --- hack/lib/golang.sh | 12 ++++++++++++ third_party/gimme/gimme | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index b2e202e70e7..ed6d3297fdc 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -524,6 +524,18 @@ kube::golang::internal::verify_go_version() { if [ "${GOTOOLCHAIN:-auto}" != 'auto' ]; then # no-op, just respect GOTOOLCHAIN : + elif [ "${GO_VERSION:-}" == 'devel' ]; then + # get the latest master version of Go, build and use that version + export GOTOOLCHAIN='local' + if [[ ! -f "${KUBE_ROOT}/.gimme/envs/gomaster.env" && ! -f "${HOME}/.gimme/envs/gomaster.env" ]]; then + GOROOT_BOOTSTRAP="${GOROOT_BOOTSTRAP:-/usr/local/go}" "${KUBE_ROOT}/third_party/gimme/gimme" "master" >/dev/null 2>&1 + fi + + if [[ -f "${KUBE_ROOT}/.gimme/envs/gomaster.env" ]]; then + source "${KUBE_ROOT}/.gimme/envs/gomaster.env" + elif [[ -f "${HOME}/.gimme/envs/gomaster.env" ]]; then + source "${HOME}/.gimme/envs/gomaster.env" + fi elif [ -n "${FORCE_HOST_GO:-}" ]; then # ensure existing host version is used, like before GOTOOLCHAIN existed export GOTOOLCHAIN='local' diff --git a/third_party/gimme/gimme b/third_party/gimme/gimme index 75e618da2f2..ac3330be632 100755 --- a/third_party/gimme/gimme +++ b/third_party/gimme/gimme @@ -314,8 +314,10 @@ _setup_bootstrap() { # _compile "dir" _compile() { ( - if grep -q GOROOT_BOOTSTRAP "${1}/src/make.bash" &>/dev/null; then - _setup_bootstrap || return 1 + if [[ -z "${GOROOT_BOOTSTRAP}" ]]; then + if grep -q GOROOT_BOOTSTRAP "${1}/src/make.bash" &>/dev/null; then + _setup_bootstrap || return 1 + fi fi cd "${1}" if [[ -d .git ]]; then