Last active
December 12, 2021 15:58
-
-
Save amalmurali47/ad2f82ee985696fd2c37fd33d5eafa98 to your computer and use it in GitHub Desktop.
Go automatic upgrade/installation script for Linux
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
#!/bin/bash | |
version=$(curl -s "https://go.dev/dl/?mode=json" | jq '.[0].version' -r) | |
wget "https://dl.google.com/go/${version}.linux-amd64.tar.gz" | |
sudo tar -C /usr/local -xzf go*.linux-amd64.tar.gz | |
{ | |
echo '# Golang' | |
echo 'export GOPATH=$HOME/go' | |
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' | |
} >> ~/.bashrc | |
source ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment