Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: show the version GOROOT corresponds to in go bug output #15877

Closed
minux opened this issue May 29, 2016 · 9 comments
Closed

cmd/go: show the version GOROOT corresponds to in go bug output #15877

minux opened this issue May 29, 2016 · 9 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@minux
Copy link
Member

minux commented May 29, 2016

A lot of issue reports are due to incorrect $GOROOT setting.
For example, I suspect that #15874 is one of them.

I propose that go env also print the version of the tools
the GOROOT corresponds to as a comment.

For example, instead just of printing:

....
GOROOT="/Users/minux/go/rel/go1.6"
GOTOOLDIR="/Users/minux/go/rel/go1.6/pkg/tool/darwin_amd64"
...

I'd like it also show the version as a comment (so that the output
is still a valid shell script):

GOROOT="/Users/minux/go/rel/go1.6" # version go1.6
GOTOOLDIR="/Users/minux/go/rel/go1.6/pkg/tool/darwin_amd64" # version go1.5

For Windows, we probably need to use REM on separate lines:

REM version go1.6
set GOROOT=C:\go
REM version go1.5
set GOTOOLDIR=C:\go\tool\tool\windows_386\

For GOROOT, it could use the go version command from the directory,
for GOTOOLDIR, we can use compile -V to get the actual tool version.

Because GOTOOLDIR is not settable via environment variables, so
showing the tool version might not be that important, but it will definitely
help when $GOROOT/bin/go is out of sync from the toolchain (this might
help #15372.)

I'd like to add this to Go 1.7 if at all possible.

@minux minux added this to the Go1.7Beta milestone May 29, 2016
@adg
Copy link
Contributor

adg commented May 31, 2016

Sounds good to me.

@adg
Copy link
Contributor

adg commented May 31, 2016

Although I'm a bit concerned about breaking people that are parsing the output of 'go env'. Maybe these comments should only be printed with go env -v? Although I'm hesitant to add new flags.

@minux
Copy link
Member Author

minux commented May 31, 2016 via email

@davecheney
Copy link
Contributor

Can you think of a situation where having a mismatch could be anything but
a mistake? What if a mismatch caused go env to print an error and exit 1?

On Tue, 31 May 2016, 19:10 Minux Ma notifications@github.com wrote:

We can always print the comment in separate lines so it shouldn't confuse
existing parser that only looks for specific keywords.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#15877 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAcA1i35-CPxv5Xk3GgK03ZrQ0F7k_0ks5qG_sFgaJpZM4IpSJ0
.

@adg
Copy link
Contributor

adg commented Jun 1, 2016

Looks like this missed the boat for 1.7. We're cutting the beta today.

@adg adg modified the milestones: Go1.8, Go1.7Beta Jun 1, 2016
@dominikh
Copy link
Member

dominikh commented Jun 2, 2016

We can always print the comment in separate lines so it shouldn't confuse existing parser that only looks for specific keywords.

Parsers that expect each line to be a variable=value pair and don't expect anything else would break due to this, too.

Also, what about something like go env GOROOT GOPATH? A parser might expect exactly two lines of output, with the order specified in the command. That's how go-mode for Emacs currently works, and I wouldn't be surprised if other tools had the same expectations.

@minux
Copy link
Member Author

minux commented Jun 2, 2016 via email

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 6, 2016
@rsc
Copy link
Contributor

rsc commented Nov 3, 2016

Will fix in go bug instead.

@rsc rsc changed the title cmd/go: show the version GOROOT corresponds to in go env output cmd/go: show the version GOROOT corresponds to in go bug output Nov 3, 2016
@gopherbot
Copy link

CL https://golang.org/cl/32643 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants