Instead of using govm
or package manager to install updated go version I prefer to download from Go's official website.
My usual Go update routine
Make sure the Go path is still set correctly (you only need to set this once in your .bashrc
or .zshrc
)
Every time a new Go version comes out, I have to:
- Visit the download page
- Check if there's an updated version
- Find the version that matches my OS and architecture
- Download it
- Extract the archive
- Give the
go
directory proper permissions - Completely remove the previous Go version from
/usr/local/go
- Move the new version to
/usr/local
Then when the next version comes out? Repeat the whole thing again. But here's the thing, the manual process is incredibly tedious.
The solution
The good thing is Go's website has an API to fetch release information. This made things way easier to automate.
So I wrote a script that does all of this for me automatically.
Now instead of spending more time manually going through the process, I just run the script and it handles everything. It shows me the available versions and lets me choose which one to install, then downloads the right file for my system and sets everything up properly.
No more forgetting steps, no more downloading the wrong architecture, no more broken installations.
Check it out
The script is pretty straightforward and does exactly what I need it to do. You can check out the source code here if you want to see how it works or use it yourself.
Top comments (0)