Go languageThe development environment depends on some operating system environment variables. Here are some of the most important environment variables:
GOROOT means Go is in The installation location on your computer is usually $HOME/go. Of course, you can also install it elsewhere.
GOARCH represents the processor architecture of the target machine, its value can be 386, amd64 or arm.
GOOS represents the operating system of the target machine, its value can be darwin, freebsd, linux or windows.
We can view the environment information of go through the go env command
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/lvhy/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/lvhy/go" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/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/2w/tt1p_4td3yq9xlbl7c2t4jn00000gn/T/go-build878610085=/tmp/go-build -gno-record-gcc-switches -fno-common"
The above is the detailed content of How to view environment information in go language. For more information, please follow other related articles on the PHP Chinese website!