go macos环境配置(超级简单)

之前老听同事讲要学go(压根没有在意),直到知道很多开源项目(docker,etcd,kubernetes)都是go的实现。

1、$ brew install go  #默认源安装

2、$ go version #查看版本
go version go1.12.1 darwin/amd64

3、$ vim .bash_profile #修改环境变量

export GOPATH=/Users/xxx/Documents/projects/go_prj
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

4、$ source .bash_profile #使其立即生效

5、$ go env #查看env已生效

GOARCH="amd64"
GOBIN="/Users/xxx/Documents/projects/go_prj/bin"
GOCACHE="/Users/xxx/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xxx/Documents/projects/go_prj"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fh/hhrjrs4n4zs3858xbnhgb4800000gn/T/go-build439893406=/tmp/go-build -gno-record-gcc-switches -fno-common"

猜你喜欢

转载自blog.csdn.net/wangtingting_100/article/details/88952227