Jnnngs
Home
About
 Admin
  ~1 minute

Ubuntu - install latest Golang

Remove Golang

sudo apt-get install software-properties-common &&
sudo apt-get remove golang-go &&
sudo apt-get remove --auto-remove golang-go &&
sudo apt-get uninstall purge golang* &&
sudo apt-get update &&
sudo rm -rf /usr/local/go

Install latest Golang

sudo apt-get install golang &&
sudo apt-get install software-properties-common &&
sudo add-apt-repository ppa:longsleep/golang-backports &&
sudo apt update &&
sudo apt install golang-1.20

vi ~/.bashrc

At these at the end of the file

export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Logoff, back on and run go version