Skip to content

Instantly share code, notes, and snippets.

@amalmurali47
Last active December 12, 2021 15:58
Show Gist options
  • Save amalmurali47/ad2f82ee985696fd2c37fd33d5eafa98 to your computer and use it in GitHub Desktop.
Save amalmurali47/ad2f82ee985696fd2c37fd33d5eafa98 to your computer and use it in GitHub Desktop.
Go automatic upgrade/installation script for Linux
#!/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