Pages

Saturday, 19 September 2015

在mac运行brew install go后,得到的提示



As of go 1.2, a valid GOPATH is required to use the `go get` command:
  https://golang.org/doc/code.html#GOPATH

You may wish to add the GOROOT-based install location to your PATH:
  export PATH=$PATH:/usr/local/opt/go/libexec/bin
==> Summary

 /usr/local/Cellar/go/1.5.1: 5330 files, 273M
------------
ogon:~ ym$ export PATH=$PATH:/usr/local/Cellar/go/1.5.1/libexec/bin/
bogon:~ ym$ export GOROOT=/usr/local/Cellar/go/1.5.1/
/usr/local/Cellar/go/1.5.1/就是go的安装目录)
(GOPATH的路径不能设得跟GOROOT的路径一样。以后可临时设置GOPATH的环境变量,比如
mkdir gospace
cd gospace
export GOPATH=/path/to/gospace/
然后,就可在gospace目录里运行go get github.com/xx/yy了。)
----------
mac下,安装go环境,也可参考http://briteming.blogspot.com/2015/10/macgo.html