安裝go1.9:
1.安裝
brew install [email protected]
2.配置golang的相關環境變量 vim ~/.bash_profile
export GOROOT=/usr/local/opt/go\@1.9
export PATH=$PATH:$GOROOT/bin
3.試一試golang是否安裝成功
出現以下內容,則安裝成功
安裝Go1.13
1.通過curl下載go1.13:
curl -o golang.pkg https://dl.google.com/go/go1.13.1.darwin-amd64.pkg
2.在Mac os安裝
sudo open golang.pkg
3.設置環境變量 vim ~/.bash_profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go/src
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
4.安裝依賴工具
go get -u github.com/kardianos/govendor
5.測試是否安裝成功
$ go version
go version go1.13.1 darwin/amd64