## 环境配置
当你的 Golang 安装完成后,需要检查以下环境变量是否配置正确:
- `$GOPATH` 配置 go 的工作目录
- `$PATH` 将 $GOPATH/bin 目录加入该环境变量,可以直接执行安装的命令
- `$GO111MODULE` 配置 "on" 开启 go mod
- `$GOPROXY` 配置 "https://goproxy.io" 开启代理
配置完成后查看配置结果:
~~~
$> go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/***/golang/bin"
GOCACHE="/Users/***/Library/Caches/go-build"
GOENV="/Users/***/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/***/golang"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
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="/Users/***/***/go.mod"
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/gw/f8fnsvhj3dgcsgyz9vfx28040000gn/T/go-build030193521=/tmp/go-build -gno-record-gcc-switches -fno-common"
~~~