Closed
Description
go env -json
tells me a lot about the user's Go setup and environment, and in a format that's easy to parse. Unfortunately, go version
is missing there, so if I want to fetch that I need a separate exec call.
I wonder if we could add it to go env, similar to other "not really an env var" lines like GOMOD
, GOEXE
, or GOHOSTARCH
. For example:
$ go version
go version go1.15 linux/amd64
$ go env -json
[...]
"GOVERSION": "go1.15",
[...]
It would not include the string prefix go version
, since it's redundant, nor the linux/amd64
pair, since that's already as GOHOSTOS/GOHOSTARCH
in go env
.
I'm not making this a proposal for now, since the idea seems pretty simple.
/cc @bcmills @jayconrod @matloob for cmd/go