I have searched for a way to update golang, and I got confused with all the different answers. I tried some but none worked for me. I'm using ubuntu 20.04 on wsl 2.
This article seemed like a reasonable answer, but it didn't work. Is there any way to automate go update?
CodePudding user response:
You can download latest Go tooling for Linux here: https://go.dev/dl/ and follow these installation instructions https://go.dev/doc/install (select Linux tab).
Alternative on Ubuntu is to add this PPA with stable Go backports: https://launchpad.net/~longsleep/ archive/ubuntu/golang-backports and then install Go by simply using apt install golang
. This will play nice with system wide updates. apt update
will see any new versions of Go once they are backported to PPA and apt upgrade
will install them.
See this page https://github.com/zchee/golang-wiki/blob/master/Ubuntu.md for more options such as Snap or getgo.
CodePudding user response:
what you can do is simply head over to the official golang website and download the setup, afterwards remove the previous golang installation by heading to /usr/local and removing go dir.
once you have removed the previous installation now go and copy/paste your new setup in /usr/local, reboot system and go will be updated