x/tools/go/packages: IgnoreFuncBodies implementation and comment mismatch #34806
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
https://github.com/golang/tools/blob/567d1c21dc5f922038933aa862c0719a9768eb83/go/packages/packages.go#L827-L830
The comment and the given example is self-contradictory. The implementation is actually
type-check bodies of functions only in initial packages
.For my use case, I would appreciate if
IgnoreFuncBodies
could be somehow controlled bypackages.Config
.I have a script (invoked by
go generate
) parsing source code, harvesting struct definition and generating serialization-related code for those structs. Due to lack of serialization-related code, the type-checking for function bodies always fail because those structs does not implement my serialization interface yet.I don't have any assertions like
var _ MySerializationInterface = MyStruct{}
. So as long as I can turnIgnoreFuncBodies
on, everything works for me.The text was updated successfully, but these errors were encountered: