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
proposal: cmd/go: add a way to query for non-defaults in the env #34208
Comments
This got no attention, so I'm rewriting it into a proposal. |
I think this is a good idea, both because it helps us and because it might help the user with "bugs" that are really misconfigurations. Would it make sense to simply enhance the existing output with a trailing shell comment for the modified ones, that way it still copy-pastes as environment variable settings? E.g.
|
That would work for me too. Though that might be a little too close to shell syntax for people's comfort :) I also wonder if backwards compatibility would be a problem. For example, |
We briefly discussed this in today's tools call. @jayconrod mentioned comments, but I'm still a bit worried about those in case anyone is expecting simple Another idea that came out during the call would be extending
cc @bcmills |
what about explaining where each value comes from?
|
It's common to ask users to provide
go version
andgo env
when they report a bug. There is one problem with that, though - the output is getting huge, and most of it is generally useless. For example:What's special about my environment? You can easily spot
GO111MODULE
orGOBIN
as they are commonly set, and they are near the top. But what variables have I actually modified from the defaults on my system?It would be useful to quickly see what Go env variables were specifically modified by a user. That is, what could be special about the user's environment, that could help in reproducing a bug they're running into.
I can kind of get that right now with a bit of shell hackery, showing the changes between my
go env
and the samego env
with an empty environment:This is much better. It even has some surprises - I botched my
GOPROXY
by forgetting,direct
, for example. And I'm not sure whyGOGCCFLAGS
is different.GONOPROXY
andGONOSUMDB
are also a bit redundant as they simply followGOPRIVATE
here, but that's a minor thing.It would be useful to be able to print a summary like the above, perhaps with
go env -diff
orgo env -changed
. Note that the idea is to show what's different from the defaults on that machine, so usuallyGOARCH
andGOOS
wouldn't be included.The text was updated successfully, but these errors were encountered: