From e03a99d2ab47ab25db103799f76c87f94857bb01 Mon Sep 17 00:00:00 2001 From: Andrew Stowell Date: Fri, 10 May 2024 17:21:38 +0000 Subject: [PATCH] go install now auto-resolves latest version --- one-time-stuff/install-software.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/one-time-stuff/install-software.sh b/one-time-stuff/install-software.sh index 83c5d41..4bb6a26 100755 --- a/one-time-stuff/install-software.sh +++ b/one-time-stuff/install-software.sh @@ -138,9 +138,17 @@ echo "----- Install Go Lang -------------------------------" read -p 'Install Go Lang? [y/N]: ' go_lang case $go_lang in [Yy]* ) + echo "----- Determining current stable go version ---------" + # load json file with version info, filter to only stable versions, take the first (newest), strip to just numeric + go_version=$(wget --quiet --output-document - 'https://go.dev/dl/?mode=json' | jq -r '.[] | select( .stable ) | .version' | head -n 1 | sed 's/[^0-9.]*//g') + if [[ -n "$go_version" ]]; then + version_flag='--version' + echo "Installing Go Version: $go_version" + fi + echo "----- Calling Go Install Script ---------------------" LOCATION=`dirname "$0"` - "${LOCATION}/../golang-install/goinstall.sh" + "${LOCATION}/../golang-install/goinstall.sh" "$version_flag" "$go_version" echo "----- Completed Go Install Script -------------------" ;; * )