x/tools/go/packages: passing NeedSyntax to Load() doesn't populate Syntax field unless NeedTypes is passed #35331
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Calling
packages.Load()
withpackages.NeedSyntax
doesn't actually populate package'sSyntax
field, unlesspackages.NeedTypes
is specified at the same time. This behavior seems to contradict documentation:This makes it impossible to load and parse a package without simultaneously type-checking it, which may not always be desirable.
Minimal example to reproduce
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: