Skip to content

Instantly share code, notes, and snippets.

@heatxsink
Created July 13, 2023 21:34
Show Gist options
  • Save heatxsink/66f2fedaefeeea9bfc3a86fbf1cf0814 to your computer and use it in GitHub Desktop.
Save heatxsink/66f2fedaefeeea9bfc3a86fbf1cf0814 to your computer and use it in GitHub Desktop.
#!/bin/bash
####
# Example usage ...
#
# sudo ./go-upgrade.sh https://go.dev/dl/go1.18.linux-amd64.tar.gz
#
###
if [ $# -eq 0 ]
then
echo "No arguments supplied."
exit 1
fi
FETCH_URL=$1
UPDATE_FILENAME="golang.update.tar.gz"
wget $FETCH_URL -O $UPDATE_FILENAME
rm -rf /usr/local/go
tar -C /usr/local -xzf $UPDATE_FILENAME
rm -rf $UPDATE_FILENAME
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment