commit | 846f925464e20fe9c09b289aefa4db0cdcd886b0 | [log] [tgz] |
---|---|---|
author | haya14busa <haya14busa@gmail.com> | Wed Mar 29 13:51:00 2017 +0900 |
committer | Brad Fitzpatrick <bradfitz@golang.org> | Wed Mar 29 06:50:07 2017 +0000 |
tree | 42cd766277e4d2b4c50c08a0537839ab95ce4b27 | |
parent | 9f232c1786f57051d34848db48ece398ad0329db [diff] |
cmd/go: add -json flag to go env "go env" prints Go environment information as a shell script format by default but it's difficult for some tools (e.g. editor packages) to interpret it. The -json flag prints the environment in JSON format which can be easily interpreted by a lot of tools. $ go env -json { "CC": "gcc", "CGO_CFLAGS": "-g -O2", "CGO_CPPFLAGS": "", "CGO_CXXFLAGS": "-g -O2", "CGO_ENABLED": "1", "CGO_FFLAGS": "-g -O2", "CGO_LDFLAGS": "-g -O2", "CXX": "g++", "GCCGO": "gccgo", "GOARCH": "amd64", "GOBIN": "/home/haya14busa/go/bin", "GOEXE": "", "GOGCCFLAGS": "-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build498013955=/tmp/go-build -gno-record-gcc-switches", "GOHOSTARCH": "amd64", "GOHOSTOS": "linux", "GOOS": "linux", "GOPATH": "/home/haya14busa", "GORACE": "", "GOROOT": "/home/haya14busa/src/go.googlesource.com/go", "GOTOOLDIR": "/home/haya14busa/src/go.googlesource.com/go/pkg/tool/linux_amd64", "PKG_CONFIG": "pkg-config" } Also, it supports arguments with -json flag. $ go env -json GOROOT GOPATH GOBIN { "GOBIN": "/home/haya14busa/go/bin", "GOPATH": "/home/haya14busa", "GOROOT": "/home/haya14busa/src/go.googlesource.com/go" } Fixes #12567 Change-Id: I75db3780f14a8ab8c7fa58cc3c9cc488ef7b66a1 Reviewed-on: https://go-review.googlesource.com/38757 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.