Update To Latest Go Version 1.23.5
Updating Go (Golang) on Ubuntu involves a few steps. Here’s a step-by-step guide:
1. Check the Current Version
Run the following command to check your current version of Go:
go version
2. Remove the Existing Version
If you installed Go using the official tarball, first remove the old version:
sudo rm -rf /usr/local/go
3. Download the Latest Version
Visit the official or use the command below to download the latest version (replace VERSION
with the latest version number in this case 1.23.5)
wget http://go.dev/dl/goVERSION.linux-amd64.tar.gz
For example:
wget http://go.dev/dl/go1.23.5.linux-amd64.tar.gz
4. Extract and Install
Extract the tarball to /usr/local
:
sudo tar -C /usr/local -xzf goVERSION.linux-amd64.tar.gz
For example:
sudo tar -C /usr/local -xzf go1.23.5.linux-amd64.tar.gz
5. Update Environment Variables
Ensure /usr/local/go/bin
is in your PATH. Add this to your ~/.bashrc
, ~/.zshrc
, or ~/.profile
:
export PATH=$PATH:/usr/local/go/bin
Reload the shell:
source ~/.bashrc
6. Verify the Installation
Confirm the updated version:
go version