安装源自带的go 1.18.1
sudo apt install golang-go
编译安装go1.21.6
git clone -b go1.21.6 https://github.com/golang/go
cd go/src
bash make.bash
bin移动到/opt/go1.21.6
mkdir /opt/go1.21.6
sudo cp ~/Downloads/src/go/bin /opt/go1.21.6/ -r
卸载源里面的go1.18.1
sudo apt remove golang-go
编译/etc/profile,末尾新增内容
export PATH=/opt/go1.21.6/bin:/usr/local/cuda/bin:$PATH
export GOROOT=/home/yeqiang/Downloads/src/go
验证版本
下载源码
git clone -b v1.13.0 https://github.com/ethereum/go-ethereum
cd go-ethereum
make all -j6
编译结果