在Debian上更新Golang编译器,有以下两种常用方法:
sudo apt install -y software-properties-common
,sudo add-apt-repository -y ppa:longsleep/golang-backports
。sudo apt update
。sudo apt install -y golang
。go version
。wget https://golang.org/dl/go{版本号}.linux-amd64.tar.gz
下载(替换为实际版本号)。sudo rm -rf /usr/local/go
。/usr/local
目录:sudo tar -C /usr/local -xzf go{版本号}.linux-amd64.tar.gz
。~/.bashrc
或~/.zshrc
,添加export GOROOT=/usr/local/go
,export PATH=$GOROOT/bin:$PATH
,然后运行source ~/.bashrc
或source ~/.zshrc
。go version
。