-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
x/tools/go/packages: Package.Fset is nil when using NeedSyntax #48226
Comments
@matloob per owners |
I agree that this is a bug. In my experience, the packages.Config.Mode API is just hateful. One is forced to choose between the compound Every time I use Mode, I try to do the right thing and specify just the bits I need, and then realize through painful trial and error that I need to enable some extra bit such as NeedTypes just to get access to the FileSet, defeating any possible benefit of the fine-grained interface. Apologies for my part in getting us into this mess. We should fix the bugs in the fine-grained implementation, but more importantly I think we should un-deprecate the compound modes, creating new ones as needed with appropriate names for the major use cases, and document exactly what every existing mode is good for. |
Another fun interaction of modes: without NeedModule, go/types.Config.GoVersion won't be set. Which is slightly surprising, because NeedModule is documented as populating the Module field, not as being relevant to type-checking. |
Change https://go.dev/cl/588141 mentions this issue: |
Package is both the "cooked" result data type of a Load call, and the "raw" JSON schema used by DriverResponse. This change documents the fields that are part of the protocol, and ensures that the others are omitted from the JSON encoding. (They are populated by the post- processing done by 'refine', if the appropriate Need bits are set.) Also - document that there are a number of open bugs in places where it may be likely to help, particularly Mode-related issues. - document that Load returns new Packages, using distinct symbol realms (types.Importers). - document Overlays in slightly more detail. Fixes golang/go#67614 Fixes golang/go#61418 Fixes golang/go#67601 Fixes golang/go#43850 Updates golang/go#65816 Updates golang/go#58726 Updates golang/go#56677 Updates golang/go#48226 Updates golang/go#63517 Updates golang/go#56633 Change-Id: I2f5f2567baf61512042fc344fca56494f0f5e638 Reviewed-on: https://go-review.googlesource.com/c/tools/+/588141 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
What did you do?
What did you expect to see?
false
What did you see instead?
true
Rationale
This is apparently working as intended, as the documentation reads:
However, I see no reason why
Fset
should not be exposed whenNeedSyntax
is requested. In particular,Fset
is needed for looking up position information for syntax elements.The text was updated successfully, but these errors were encountered: