-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/go/packages: 'go list -e -json' for a directory without .go source files doesn't show module-relative import path #33157
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
Comments
What happens if the main module is |
I'll work with @stamblerre more to figure out exactly why it's doing this and what should happen instead. In general, I think they mainly need a way to map a directory to an import path. |
Yes, exactly. Editors like Vim might not write anything to disk for a while, but the user will still be editing their file. We need some way to guess an import path given a directory. The code in go/packages that does this is here, and it only works because, previously, |
Moving to 1.14 as this isn't a release-blocker. Feel free to bump it back if it becomes one. |
I think that this will actually have to be a release blocker for 1.13, because it will completely break the |
I think this should be fixed in In general, overlays can't be processed by underlying build systems. If a package only exists in the overlay (not on disk) the driver needs to be smart enough to create new packages for it. The driver will also need to suppress errors for packages that are empty or incomplete because the overlay wasn't present. |
Makes sense. We will move the logic into /cc @matloob |
Change https://golang.org/cl/188764 mentions this issue: |
Change https://golang.org/cl/189038 mentions this issue: |
It should work now that go packages accepts go1.13's new go list behavior. Updates golang/go#33157 Change-Id: I1780210b414bc0556e10e10c8c775fbfd2922b2e Reviewed-on: https://go-review.googlesource.com/c/tools/+/189038 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
no, only on tip
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
The
ImportPath
field should be set to the expected import path of the directory.What did you see instead?
ImportPath
is set to the absolute path of the directory instead.Other notes
golang.org/x/tools/go/packages
relies on the old behavior for packages with new files that are edited but not saved yet.New behavior was likely introduced in CL 185417.
The text was updated successfully, but these errors were encountered: