看版本:https://go.dev/dl/
下载:
wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
卸载已有的go,可以apt remove go,也可以which go之后删除那个go文件,然后:
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
再然后:
Add /usr/local/go/bin to the PATH environment variable.
You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):
export PATH=$PATH:/usr/local/go/bin
重启终端后: