mirror of https://github.com/k3s-io/k3s
Merge pull request #58207 from strigazi/fix-cmp-ver
Automatic merge from submit-queue (batch tested with PRs 58207, 58258). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Use sort -V to compare golang versions Change hack/lib/golang.sh to compare golang version properly with "sort -s -t. -k 1,1 -k 2,2n -k 3,3n", which sorts key by key and not as strings. **What this PR does / why we need it**: trivial fix: hack/lib/golang.sh compare versions like strings, 1.10 is greater than 1.9 as a version but not as a string. Use "sort -s -t. -k 1,1 -k 2,2n -k 3,3n" to compare properly. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/6/head
commit
a990b04dc8
|
@ -323,7 +323,7 @@ EOF
|
||||||
go_version=($(go version))
|
go_version=($(go version))
|
||||||
local minimum_go_version
|
local minimum_go_version
|
||||||
minimum_go_version=go1.9.1
|
minimum_go_version=go1.9.1
|
||||||
if [[ "${go_version[2]}" < "${minimum_go_version}" && "${go_version[2]}" != "devel" ]]; then
|
if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then
|
||||||
kube::log::usage_from_stdin <<EOF
|
kube::log::usage_from_stdin <<EOF
|
||||||
Detected go version: ${go_version[*]}.
|
Detected go version: ${go_version[*]}.
|
||||||
Kubernetes requires ${minimum_go_version} or greater.
|
Kubernetes requires ${minimum_go_version} or greater.
|
||||||
|
|
Loading…
Reference in New Issue