对于Ubuntu 17.04 Zesty到17.10 Artful上的Golang 1.8:
# sudo apt update
# sudo apt install golang-1.8 golang-1.8-doc
# for bin in /usr/lib/go-1.8/bin/* ; do
sudo update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 0
sudo update-alternatives --set $(basename $bin) $bin
done
对于Ubuntu 17.10 Artful到18.04 Bionic上的Golang 1.9:
# sudo apt update
# sudo apt install golang-1.9 golang-1.9-doc
# for bin in /usr/lib/go-1.9/bin/* ; do
sudo update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 0
sudo update-alternatives --set $(basename $bin) $bin
done
对于Ubuntu 18.04 Bionic和18.10 Cosmic上的Golang 1.10:
# sudo apt update
# sudo apt install golang-1.10 golang-1.10-doc
# for bin in /usr/lib/go-1.10/bin/* ; do
sudo update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 0
sudo update-alternatives --set $(basename $bin) $bin
done