brew install go
配置路徑linux
vim ~/.bash_profile
#export PATH export GOROOT=/usr/local/Cellar/go/1.8.1/libexec export GOBIN=$GOROOT/bin export GOPATH=/Users/antic/www/go export PATH=$PATH:$GOBIN
讓配置當即生效
source .bash_profile
查看 go env
golang
antic:~ antic$ go env GOARCH="amd64" GOBIN="/usr/local/Cellar/go/1.8.1/libexec/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/antic/www/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.8.1/libexec" GOTOOLDIR="/usr/local/Cellar/go/1.8.1/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dw/35ddtk3n68d3p_sy3052gzr80000gn/T/go-build692262960=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz tar zxvf go1.9.1.linux-amd64.tar.gz mv go /usr/local/ vim /etc/profile 添加:export PATH=$PATH:/usr/local/go/bin source /etc/profile