Last active
October 23, 2023 15:43
-
-
Save tiagocesar/1f843fefd5f08497344d622a3f4b56a4 to your computer and use it in GitHub Desktop.
Update Go to the latest version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Updates Go to the latest version | |
update_go() { | |
latest_go_version=`curl -L https://go.dev/VERSION\?m\=text | cut -f3 -d ' '` | |
current_go_version=`go version 2>/dev/null | cut -f3 -d ' '` | |
if [ "$current_go_version" != "$latest_go_version" -a "$latest_go_version" != "" ]; then | |
echo "* Updating Go to version $latest_go_version (from $current_go_version)" | |
sudo sh -c "rm -fr /usr/local/go && curl -C - --silent https://dl.google.com/go/${latest_go_version}.darwin-arm64.tar.gz |tar -C /usr/local -xzf -" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment