Differences
This shows you the differences between two versions of the page.
| go_env [2018/04/10 16:02] – created rpjday | go_env [2018/04/10 17:04] (current) – [go env] rpjday | ||
|---|---|---|---|
| Line 30: | Line 30: | ||
| PKG_CONFIG=" | PKG_CONFIG=" | ||
| GOGCCFLAGS=" | GOGCCFLAGS=" | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | ===== go help environment ===== | ||
| + | |||
| + | < | ||
| + | $ go help environment | ||
| + | The go command, and the tools it invokes, examine a few different | ||
| + | environment variables. For many of these, you can see the default | ||
| + | value of on your system by running 'go env NAME', where NAME is the | ||
| + | name of the variable. | ||
| + | |||
| + | General-purpose environment variables: | ||
| + | |||
| + | GCCGO | ||
| + | The gccgo command to run for 'go build -compiler=gccgo' | ||
| + | GOARCH | ||
| + | The architecture, | ||
| + | Examples are amd64, 386, arm, ppc64. | ||
| + | GOBIN | ||
| + | The directory where 'go install' | ||
| + | GOOS | ||
| + | The operating system for which to compile code. | ||
| + | Examples are linux, darwin, windows, netbsd. | ||
| + | GOPATH | ||
| + | For more details see: 'go help gopath' | ||
| + | GORACE | ||
| + | Options for the race detector. | ||
| + | See https:// | ||
| + | GOROOT | ||
| + | The root of the go tree. | ||
| + | GOTMPDIR | ||
| + | The directory where the go command will write | ||
| + | temporary source files, packages, and binaries. | ||
| + | GOCACHE | ||
| + | The directory where the go command will store | ||
| + | cached information for reuse in future builds. | ||
| + | |||
| + | Environment variables for use with cgo: | ||
| + | |||
| + | CC | ||
| + | The command to use to compile C code. | ||
| + | CGO_ENABLED | ||
| + | Whether the cgo command is supported. Either 0 or 1. | ||
| + | CGO_CFLAGS | ||
| + | Flags that cgo will pass to the compiler when compiling | ||
| + | C code. | ||
| + | CGO_CFLAGS_ALLOW | ||
| + | A regular expression specifying additional flags to allow | ||
| + | to appear in #cgo CFLAGS source code directives. | ||
| + | Does not apply to the CGO_CFLAGS environment variable. | ||
| + | CGO_CFLAGS_DISALLOW | ||
| + | A regular expression specifying flags that must be disallowed | ||
| + | from appearing in #cgo CFLAGS source code directives. | ||
| + | Does not apply to the CGO_CFLAGS environment variable. | ||
| + | CGO_CPPFLAGS, | ||
| + | Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, | ||
| + | but for the C preprocessor. | ||
| + | CGO_CXXFLAGS, | ||
| + | Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, | ||
| + | but for the C++ compiler. | ||
| + | CGO_FFLAGS, | ||
| + | Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, | ||
| + | but for the Fortran compiler. | ||
| + | CGO_LDFLAGS, | ||
| + | Like CGO_CFLAGS, CGO_CFLAGS_ALLOW, | ||
| + | but for the linker. | ||
| + | CXX | ||
| + | The command to use to compile C++ code. | ||
| + | PKG_CONFIG | ||
| + | Path to pkg-config tool. | ||
| + | |||
| + | Architecture-specific environment variables: | ||
| + | |||
| + | GOARM | ||
| + | For GOARCH=arm, the ARM architecture for which to compile. | ||
| + | Valid values are 5, 6, 7. | ||
| + | GO386 | ||
| + | For GOARCH=386, the floating point instruction set. | ||
| + | Valid values are 387, sse2. | ||
| + | GOMIPS | ||
| + | For GOARCH=mips{, | ||
| + | Valid values are hardfloat (default), softfloat. | ||
| + | |||
| + | Special-purpose environment variables: | ||
| + | |||
| + | GOROOT_FINAL | ||
| + | The root of the installed Go tree, when it is | ||
| + | installed in a location other than where it is built. | ||
| + | File names in stack traces are rewritten from GOROOT to | ||
| + | GOROOT_FINAL. | ||
| + | GO_EXTLINK_ENABLED | ||
| + | Whether the linker should use external linking mode | ||
| + | when using -linkmode=auto with code that uses cgo. | ||
| + | Set to 0 to disable external linking mode, 1 to enable it. | ||
| + | GIT_ALLOW_PROTOCOL | ||
| + | Defined by Git. A colon-separated list of schemes that are allowed to be used | ||
| + | with git fetch/ | ||
| + | considered insecure by 'go get'. | ||
| $ | $ | ||
| </ | </ | ||