-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/internal/bug: the implementation should have more comments #45803
Comments
This comment has been minimized.
This comment has been minimized.
I don't really see a bug here, in the sense of behavior that is incorrect and should change. Discussion about the code can be on golang-nuts. Also, please don't post patches on the issue tracker. Please only send them via GitHub or Gerrit. Patches on the issue tracker don't have any copyright licensing, so we can't use them. Thanks. Please do go ahead and send in the patch via GitHub or Gerrit if you want somebody to review it. |
cc @bcmills Thanks for filing this. As Ian said, this is probably not the best place to discuss this or to send patches. Thanks. |
Excluding the patch (that was only an example, not intended to be used/submitted), isn't code not well documented and possibly ambiguous considered an issue? Thanks. |
If the code is unclear or not well documented (and I agree that this particular code is at least the latter), it's fine to send a CL to improve the documentation, with or without an issue filed. To the specific questions:
Yes. That is a recent and intentional change.
I think that falling back to
The
A bit of code archaeology reveals that those lines were added in CL 32643, for #15877. They are there to help diagnose mismatches between the user's
Yes.
From the discussion on #15877, it appears that is intended to diagnose the case when |
About 3., formatting an environment variable takes a lot of code: go/src/cmd/go/internal/envcmd/env.go Line 350 in 4c1a7ab
So, in order to avoid starting a Thanks. |
Change https://golang.org/cl/314230 mentions this issue: |
Add the printGoEnv function to print the go environment variables, using the envcmd package instead of invoking go env. Add the PrintEnv function to the envcmd package, to avoid duplicating code. Updates #45803 Change-Id: I38d5b936c0ebb16e741ffbee4309b95d6d0ecc6c Reviewed-on: https://go-review.googlesource.com/c/go/+/314230 Reviewed-by: Bryan C. Mills <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Currently, the implementation of the go bug command is a bit confusing.
go version
is obtained usingruntime.Version
go env
is obtained invokingos.Executable env
, falling back toGOROOT/bin/go env
go env
output is OS specific (UNIX, Windows and plan9), but it is not clear if using only UNIX output is possiblego version
is printed a second time, using the labelGOROOT/bin/go version
, invokingGOROOT/bin/go env
.The code don't says why there is a second version printed; is it for compatibility reasons?
Another issue is that the
go
command invoked may be different from the one invoked in 2.Is this the intended behavior?
GOROOT/bin/go tool compile
has the same issues as 4.The text was updated successfully, but these errors were encountered: