0x1 Delete golang #
sudo rm -rf /usr/local/go/
0x2 Install golang #
去官网下载相关平台最新安装包,然后上传至升级机器,再解压安装升级包。如果机器上有网络连接则可以通过wget命令来进行升级。
sudo tar -C /usr/local/ -xzf go1.20.5.linux-amd64.tar
或者通过wget安装升级
wget https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
0x3 Add to system path #
sudo vim /etc/profile
export PATH=$PATH:/usr/local/go/bin
0x4 Source profile #
source /etc/profile
0x5 Identify result #
go version