From d2786bed20980b0dae1212006cfca52ec4a63bfb Mon Sep 17 00:00:00 2001 From: Heinrich 'Henrik' Langos Date: Sun, 12 Feb 2023 11:17:24 +0100 Subject: Fix go version check for 1.20 and above --- preflight.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/preflight.sh b/preflight.sh index 06e43c1..24e02ee 100755 --- a/preflight.sh +++ b/preflight.sh @@ -73,9 +73,12 @@ check_goversion() { return 1 fi - gover="$(go version | grep -o -E 'go[0-9]+\.[0-9]+(\.[0-9]+)?')" + gover=$(go version | sed -E 's/.*go([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/') + major=$(echo $gover | cut -d. -f1) + minor=$(echo $gover | cut -d. -f2) + patch=$(echo $gover | cut -d. -f3) - if ! go version | grep -E 'go1\.1[789](\.[0-9]+)?' > /dev/null; then + if [ "$major" -lt "1" ] || [ "$major" -eq "1" -a "$minor" -lt "17" ] ; then log2 "Go 1.17+ is required, found ${gover}" return 1 fi -- cgit v1.2.3