-
Notifications
You must be signed in to change notification settings - Fork 18k
go/build: better explanation for "cannot find package" #4079
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
Labels
Milestone
Comments
I'd like to take a stab at this as I have a strong incentive to make this better for people on the IRC channel. Here are some suggestions i've played around with % go build foo/quxx can't load package: package foo/quxx: import "foo/quxx": cannot find package in $GOROOT="/home/dfc/go" or $GOPATH="/home/dfc" This is the original suggestion, but I think it lacks something as GOPATH for example doesn't actually mention /home/dfc/src, where src is the crucial bit that trips up a lot of people. % go build foo/quxx can't load package: package foo/quxx: import "foo/quxx": cannot find package in ["/home/dfc/go/src/pkg" "/home/dfc/src"] This is a different version using ctxt.SrcDirs(), which gives the canonical list of paths that would be searched for the package, but doesn't explain how they are discovered, and in the case that GOPATH was not set, would only list the GOROOT derived, /home/dfc/go/src/pkg. This has the downside of leading users into trying to set GOPATH somewhere inside GOROOT, or using sudo. Owner changed to @davecheney. |
It's fine to make the error multiple lines: cannot find "foo/quux" in any of: /home/rsc/g/go/src/pkg/foo/quux (from $GOROOT) /home/rsc/goroot1/src/foo/quux (from $GOPATH) /home/rsc/goroot2/src/foo/quux cannot find "foo/quux" in any of: /home/rsc/g/go/src/pkg/foo/quux (from $GOROOT) ($GOPATH not set) |
https://golang.org/cl/6899057 Status changed to Started. |
This issue was closed by revision 11d96dd. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text was updated successfully, but these errors were encountered: