new/version-input #3

Merged
jake merged 11 commits from new/version-input into main 2026-05-27 18:55:06 +00:00
Showing only changes of commit 632f667417 - Show all commits

View File

@@ -32,24 +32,22 @@ function fixVersion {
} }
#start script #start script
echo "Starting Golang install"
#validate version and architecture
echo "Parsing go version" echo "Parsing go version"
#looking for go version in go.mod file, only checking up to minor version ignoring patch value to allow for stable versions #check install version field first
# -P uses perl syntax if [[ -z $GO_INSTALL_VERSION ]]; then
DL_VERSION_RAW="$(grep "^go [0-9]+.[0-9]+" go.mod -P)" # -P uses perl syntax
if [[ -z "$DL_VERSION_RAW" ]]; then DL_VERSION_RAW="$(grep "^go [0-9]+.[0-9]+" go.mod -P)"
#no go.mod file found if [[ -z "$DL_VERSION_RAW" ]]; then
DL_VERSION_RAW=$GO_INSTALL_VERSION
#no version input set either
if [[ "$DL_VERSION_RAW" == "." ]]; then
echo "FATAL: No Go version found, set version input if no go.mod file is present" echo "FATAL: No Go version found, set version input if no go.mod file is present"
exit 1 exit 1
else
fixVersion
fi fi
else else
fixVersion DL_VERSION_RAW="$GO_INSTALL_VERSION"
fi fi
echo "Found go version: ${DL_VERSION_RAW}" echo "Found go version: ${DL_VERSION_RAW}"
DL_ARCH=$GO_INSTALL_ARCH DL_ARCH=$GO_INSTALL_ARCH