- Open the package file you downloaded and follow the prompts to install Go.
The package installs the Go distribution to /usr/local/go. The package should put the /usr/local/go/bin directory in your
PATH
environment variable. You may need to restart any open Terminal sessions for the change to take effect. - Verify that you've installed Go by opening a command prompt and typing the following command:
$ go version
- Confirm that the command prints the installed version of Go.
3 配置GOROOT、GOPATH、PATH
编辑文件
export GOROOT="/usr/local/Cellar/go/1.15.3/libexec"
export GOPATH="/Users/apple/doc/GoProjects"
export PATH="/Users/apple/doc/GoProjects/bin:$PATH"
export GO111MODULE=on
export GOPROXY=https://mirrors.aliyun.com/goproxy/
GOROOT
go 安装目录,此处brew安装,