mac安装go环境
下载pkg文件
https://golang.google.cn/dl/
sudo vim /etc/profile
11 export GOROOT=/usr/local/go
12 export GOPATH=${GOROOT}/gopath
13 export PATH=$PATH:${GOROOT}/bin
14 export GO111MODULE=on
15 export GOPROXY=https://goproxy.cn
source /etc/profile
说明:
1. GOROOT 为go安装目录, 在mac下使用pkg包安装的, 目录为 /usr/loca/go
如果用go mod gopath 设置为/usr/local/go/gopath
查看环境
go env
macdeMacBook-Pro:www mac$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mac/Library/Caches/go-build" GOENV="/Users/mac/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/mac/Desktop/go_learn" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" 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/fc/4txmmczj6q92p6058h3w7t_80000gn/T/go-build984019761=/tmp/go-build -gno-record-gcc-switches -fno-common"
cd /Users/mac/Desktop/go_learn
macdeMacBook-Pro:go_learn mac$ go mod init brady
go: creating new go.mod: module brady
macdeMacBook-Pro:go_learn mac$ export GO111MODULE=on
相关推荐
Micusd 2020-11-19
cheidou 2020-11-19
星马殇 2020-11-18
Echodat 2020-10-08
flyToSkyL 2020-09-11
zjc 2020-09-03
阳光普照 2020-09-01
十年砍柴 2020-08-30
猪猪侠喜欢躲猫猫 2020-08-17
ladewang 2020-08-17
渣渣灰 2020-08-13
blankt 2020-08-15
vickay 2020-08-09
TinyDolphin 2020-08-09
山兔与孟婆 2020-08-09
longjing 2020-08-07
xiaogoua 2020-08-06