new/version-input #3
22
install.sh
22
install.sh
@@ -32,24 +32,22 @@ function fixVersion {
|
||||
}
|
||||
|
||||
#start script
|
||||
echo "Starting Golang install"
|
||||
|
||||
#validate version and architecture
|
||||
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
|
||||
# -P uses perl syntax
|
||||
DL_VERSION_RAW="$(grep "^go [0-9]+.[0-9]+" go.mod -P)"
|
||||
if [[ -z "$DL_VERSION_RAW" ]]; then
|
||||
#no go.mod file found
|
||||
DL_VERSION_RAW=$GO_INSTALL_VERSION
|
||||
#no version input set either
|
||||
if [[ "$DL_VERSION_RAW" == "." ]]; then
|
||||
#check install version field first
|
||||
if [[ -z $GO_INSTALL_VERSION ]]; then
|
||||
# -P uses perl syntax
|
||||
DL_VERSION_RAW="$(grep "^go [0-9]+.[0-9]+" go.mod -P)"
|
||||
if [[ -z "$DL_VERSION_RAW" ]]; then
|
||||
echo "FATAL: No Go version found, set version input if no go.mod file is present"
|
||||
exit 1
|
||||
else
|
||||
fixVersion
|
||||
fi
|
||||
else
|
||||
fixVersion
|
||||
DL_VERSION_RAW="$GO_INSTALL_VERSION"
|
||||
fi
|
||||
|
||||
|
||||
echo "Found go version: ${DL_VERSION_RAW}"
|
||||
|
||||
DL_ARCH=$GO_INSTALL_ARCH
|
||||
|
||||
Reference in New Issue
Block a user