-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: missing TypesInfo when NeedTypesInfo was set while NeedSyntax & NeedTypes were not #69931
Comments
While the |
Agree on that, but the behaviors of different combinations of LoadModes still make no sense, for example:
Reason for above two cases is probably because |
Possibly the right fix here is just: --- a/go/packages/packages.go
+++ b/go/packages/packages.go
@@ -1158,7 +1158,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
}
lpkg.Syntax = files
- if ld.Config.Mode&NeedTypes == 0 {
+ if ld.Config.Mode&(NeedTypes|NeedTypesInfo) == 0 {
return
}
It's a little weird to ask for only TypesInfo but not Syntax or Types, but I don't see any reason we can't honor the request. |
Yeah it sounds like we should make that change. I agree that it's weird to ask for TypesInfo but not Types but that we should honor the request. |
Go version
go1.22.7 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
The
NeedTypesInfo
option indicates thatpackages.Load
would addTypesInfo
field to result packages. But it turns out that whenNeedTypesInfo
was used separately fromNeedSyntax
orNeedTypes
, theTypesInfo
fields would simply benil
.What did you see happen?
When
NeedTypesInfo
was used separately fromNeedSyntax
orNeedTypes
, in LoadMode of packages.Load, theTypesInfo
fields would simply benil
.What did you expect to see?
The
TypesInfo
were produced properly.The text was updated successfully, but these errors were encountered: