go语言开发环境搭建
sdk
https://golang.google.cn/dl/
IDE
https://www.jetbrains.com/go/
go env 配置开发环境
# 启用 Go Modules 功能 go env -w GO111MODULE=on # 配置 GOPROXY 环境变量,以下三选一 # 1. 七牛 CDN go env -w GOPROXY=https://goproxy.cn,direct # 2. 阿里云 go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct # 3. 官方 go env -w GOPROXY=https://goproxy.io,direct
$ go env | grep GOPROXY GOPROXY="https://goproxy.cn"
测试一下
$ time go get golang.org/x/tour
IDE 源开发环境配置
go env -w GOMOD="/Users/limeihui/Documents/go_work
sh-3.2# go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/var/root/Library/Caches/go-build" GOENV="/var/root/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/limeihui/Documents/go_work" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/limeihui/Documents/go_work" GOPRIVATE="" GOPROXY="https://mirrors.aliyun.com/goproxy/,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="/dev/null" 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=/tmp/go-build267715044=/tmp/go-build -gno-record-gcc-switches -fno-common"