-
Notifications
You must be signed in to change notification settings - Fork 18k
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
go/build: "cannot find package <name> in any of:" message misleading #39281
Comments
simplest possible mitigation for golang#39281
As far as I can tell, this only affects users in We are not making significant changes to If there is an analogous problem in module mode, please file a separate issue and we can address that. |
I am unclear on how you could possibly use GOPATH without multiple entries, but that's not that important. Even a rare subset of a rare subset is still a few hundred users at minimum. The PR I attached is one line, a 1-minute review at most. This is really not worth 1 minute of your time to save, conservatively, a few hundred people an hour of their time? |
@davecheney , who added the original logic being modified and therefore has the context to judge whether the 1-line change is in fact as simple as it appears. |
@jkopczyn A code of conduct reminder: please be patient and respectful. In particular, don't minimize the time and effort needed to review these kinds of changes. We routinely go through several rounds of review on changes just like this. Changes to error messages need to be tested in many environments, and existing tests need to be updated. The process takes time, and even after a change is approved, it needs to be tracked, updated, and merged in the next release cycle. I agree with @bcmills here. While |
I am not asking for a significant change. I am asking for a one-line deletion which makes an existing code path get used in all nontrivial cases instead of only in the first nontrivial case. It adds no additional testing surface, and in fact reduces testing surface. I am not exaggerating or minimizing when I say that this would be a 1-minute review, whether the decision in that review was to approve it or to reject it. I already checked the rest of the repo to see if there were any test files or expectations which it would affect; I couldn't find any. If I've missed some, it will be a simple matter of deleting a test case which covered the deleted path, though I admit that would make it a slightly larger PR and a slightly longer review. Further, if GOPATH is not deprecated, then it's still supported and should be treated as such. This generates misleading messages and the mitigation is dead simple. I can see why you wouldn't want to do the larger change to a great format when it's in maintenance mode, so I'm not asking for that. But changing from a misleading format to a reasonably-good one is a deletion of one short line. |
What version of Go are you using (
go version
)?go1.14.2 linux/amd64
What did you do?
I try to build (well, vet, but the message comes from
src/go/build/build.go
) a file which imports a module. That module is not in my$GOROOT
, or in my multiple-entry$GOPATH
.The error message I got was
A naive reading of this message is that
/golang-root/src/api/test/metadata/v1
is sourced from my$GOROOT
,/path/to/home/dir/foo/bar/baz/src/api/test/metadata/v1
is sourced from my$GOPATH
, and the other two are sourced from somewhere else, no explanation given.The actual answer is that the first line is from
$GOROOT
and all the others are from$GOPATH
. This is highly unintuitive from the format the message is given in. To properly convey this information, I suggest this format:Note the additional indents for the second and further entries from
$GOPATH
; IIUC$GOROOT
should never have multiple entries so this would not apply to that.Alternate suggestion, IMO yet more clear but with the drawback of taking up more screen real estate:
This format could optionally indent all the paths or outdent the "
(from $GO....:)
" lines.The text was updated successfully, but these errors were encountered: