go默认环境配置:
(Linux-Ubuntu 默认安装go时的环境配置)
root@Ubuntu-18-server:/home# go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/root/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/root/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" 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=/tmp/go-build831552970=/tmp/go-build -gno-record-gcc-switches" root@Ubuntu-18-server:/home#
go开发环境配置,用于指导开发:
lixiaomei:go_work limeihui$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" //如果不指定GOBIN的话,编译后的可执行文件默认放在GOPATH/bin目录下 GOCACHE="/Users/limeihui/Library/Caches/go-build" GOENV="/Users/limeihui/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/limeihui/Documents/go_work/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/limeihui/Documents/go_work" GOPRIVATE=""
GOPROXY=https://mirrors.aliyun.com/goproxy/,direct //Mac需要配置代理 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/2f/f33qpdds5992h3c4nv5qclk80000gn/T/go-build323116324=/tmp/go-build -gno-record-gcc-switches -fno-common" lixiaomei:go_work limeihui$
工程源码环境:::
go mod 自动管理依赖,下载工程依赖包::