github.com/mailru/activerecord@v1.12.2/scripts/goversioncheck.sh (about) 1 #!/usr/bin/env bash 2 3 GO_CMD=${GO_CMD:-go} 4 5 GO_VERSION_MIN=$1 6 echo "==> Checking that build is using go version >= $1..." 7 8 if $GO_CMD version | grep -q devel; 9 then 10 GO_VERSION="devel" 11 else 12 GO_VERSION=$($GO_CMD version | grep -o 'go[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' | tr -d 'go') 13 14 IFS="." read -r -a GO_VERSION_ARR <<< "$GO_VERSION" 15 IFS="." read -r -a GO_VERSION_REQ <<< "$GO_VERSION_MIN" 16 17 if [[ ${GO_VERSION_ARR[0]} -lt ${GO_VERSION_REQ[0]} || 18 ( ${GO_VERSION_ARR[0]} -eq ${GO_VERSION_REQ[0]} && 19 ( ${GO_VERSION_ARR[1]} -lt ${GO_VERSION_REQ[1]} || 20 ( ${GO_VERSION_ARR[1]} -eq ${GO_VERSION_REQ[1]} && ${GO_VERSION_ARR[2]} -lt ${GO_VERSION_REQ[2]} ))) 21 ]]; then 22 echo "Neobank requires go $GO_VERSION_MIN to build; found $GO_VERSION." 23 exit 1 24 fi 25 fi 26 27 echo "==> Using go version $GO_VERSION..."