Install WSL First
# select the latest release: https://go.dev/dl
cd ~
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
mkdir go
# configure file
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin
Update Version
sudo rm -rf /usr/local/go
# delete and reinstall the latest version
Or
git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh