From f30e3c0ab745712047d78310abee05161b899019 Mon Sep 17 00:00:00 2001 From: victornguen Date: Thu, 10 Jul 2025 00:15:32 +0300 Subject: [PATCH] Fix kube_codegen.sh to correctly resolve GOBIN via go env kube_codegen.sh was not resolving GOBIN correctly when it was set using 'go env -w GOBIN='. The script only checked the environment variable and fell back to /bin, but it missed the case where GOBIN is configured via 'go env -w' without being exported. This fix: - Uses 'go env GOBIN' to get the correct GOBIN location - Falls back to 'go env GOPATH/bin' when GOBIN is empty - Applies the fix to all four functions in the script: - kube::codegen::gen_helpers - kube::codegen::gen_openapi - kube::codegen::gen_client - kube::codegen::gen_register --- .../src/k8s.io/code-generator/kube_codegen.sh | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/code-generator/kube_codegen.sh b/staging/src/k8s.io/code-generator/kube_codegen.sh index 478ddde11a6a4..eb8c8829807e4 100755 --- a/staging/src/k8s.io/code-generator/kube_codegen.sh +++ b/staging/src/k8s.io/code-generator/kube_codegen.sh @@ -117,7 +117,10 @@ function kube::codegen::gen_helpers() { GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") ) # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise - gobin="${GOBIN:-$(go env GOPATH)/bin}" + gobin="$(go env GOBIN)" + if [[ -z "${gobin}" ]]; then + gobin="$(go env GOPATH)/bin" + fi # Deepcopy # @@ -368,7 +371,10 @@ function kube::codegen::gen_openapi() { GO111MODULE=on go install $(printf "k8s.io/kube-openapi/cmd/%s " "${BINS[@]}") ) # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise - gobin="${GOBIN:-$(go env GOPATH)/bin}" + gobin="$(go env GOBIN)" + if [[ -z "${gobin}" ]]; then + gobin="$(go env GOPATH)/bin" + fi local input_pkgs=( "${extra_pkgs[@]:+"${extra_pkgs[@]}"}") while read -r dir; do @@ -601,7 +607,10 @@ function kube::codegen::gen_client() { GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") ) # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise - gobin="${GOBIN:-$(go env GOPATH)/bin}" + gobin="$(go env GOBIN)" + if [[ -z "${gobin}" ]]; then + gobin="$(go env GOPATH)/bin" + fi local group_versions=() local input_pkgs=() @@ -773,7 +782,10 @@ function kube::codegen::gen_register() { GO111MODULE=on go install $(printf "k8s.io/code-generator/cmd/%s " "${BINS[@]}") ) # Go installs in $GOBIN if defined, and $GOPATH/bin otherwise - gobin="${GOBIN:-$(go env GOPATH)/bin}" + gobin="$(go env GOBIN)" + if [[ -z "${gobin}" ]]; then + gobin="$(go env GOPATH)/bin" + fi # Register # pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy