自动安装

wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.17.5

手动安装

wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.17.1.linux-amd64.tar.gz

vi ~/.profile

#insert
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin


source ~/.profile