Skip to content

Commit dc4d0ae

Browse files
authored
Merge pull request kubernetes-csi#249 from jsafrane/use-go-version
Use .go-version to get Kubernetes go version
2 parents b54c1ba + e681b17 commit dc4d0ae

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

prow.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,15 @@ go_version_for_kubernetes () (
564564
local version="$2"
565565
local go_version
566566

567-
# We use the minimal Go version specified for each K8S release (= minimum_go_version in hack/lib/golang.sh).
567+
# Try to get the version for .go-version
568+
go_version="$( cat "$path/.go-version" )"
569+
if [ "$go_version" ]; then
570+
echo "$go_version"
571+
return
572+
fi
573+
574+
# Fall back to hack/lib/golang.sh parsing.
575+
# This is necessary in v1.26.0 and older Kubernetes releases that do not have .go-version.
568576
# More recent versions might also work, but we don't want to count on that.
569577
go_version="$(grep minimum_go_version= "$path/hack/lib/golang.sh" | sed -e 's/.*=go//')"
570578
if ! [ "$go_version" ]; then

0 commit comments

Comments
 (0)