From 73b20fd5e1353a07f2ecf08a28e8dd8f780ec324 Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 22 May 2025 21:55:30 -0400 Subject: [PATCH] adjusting version fix --- install.sh | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 3895f37..6414172 100755 --- a/install.sh +++ b/install.sh @@ -18,6 +18,19 @@ function installCommands { fi } +function fixVersion { + DL_VSPL=( $DL_VERSION_RAW ) + DL_VERSION="${DL_VSPL[1]}" + + #ensure we have patch-level version, if not add 0 for stable releases + # -P uses perl syntax + DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)" + if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then + DL_VERSION="$DL_VERSION"".0" + echo "Fixing version number to ${DL_VERSION}" + fi +} + #start script echo "Starting Golang install" @@ -34,20 +47,22 @@ if [[ -z "$DL_VERSION_RAW" ]]; then echo "FATAL: No Go version found, set version input if no go.mod file is present" exit 1 fi +else + fixVersion fi echo "Found go version: ${DL_VERSION_RAW}" DL_ARCH=$GO_INSTALL_ARCH -DL_VSPL=( $DL_VERSION_RAW ) -DL_VERSION="${DL_VSPL[1]}" +# DL_VSPL=( $DL_VERSION_RAW ) +# DL_VERSION="${DL_VSPL[1]}" -#ensure we have patch-level version, if not add 0 for stable releases -# -P uses perl syntax -DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)" -if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then - DL_VERSION="$DL_VERSION"".0" - echo "Fixing version number to ${DL_VERSION}" -fi +# #ensure we have patch-level version, if not add 0 for stable releases +# # -P uses perl syntax +# DL_VERSION_PAD_CHECK="$(grep "^go [0-9]+.[0-9]+.[0-9]+" go.mod -P)" +# if [[ -z "$DL_VERSION_PAD_CHECK" ]]; then +# DL_VERSION="$DL_VERSION"".0" +# echo "Fixing version number to ${DL_VERSION}" +# fi echo "Checking if go is already installed" #check if go is already present before starting install process and delete files if purge input is set