1.卸载旧版本的Go
go env
GOROOT="/usr/local/go"
sudo rm -r /usr/local/go
2.安装最新版的Golang
sudo tar -xzf go1.10.4.linux-amd64.tar.gz -C /usr/local
3.配置环境变量
vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go_project
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
source /etc/profile
4.查看版本等信息
go version
$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
详见:https://www.jianshu.com/p/926b0b43abf5 golang 官方包管理器安装与基本用法