Skip to content
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: IgnoreFuncBodies implementation and comment mismatch #34806

zhangyoufu opened this issue Oct 10, 2019 · 0 comments


Copy link

@zhangyoufu zhangyoufu commented Oct 10, 2019

// Type-check bodies of functions only in non-initial packages.
// Example: for import graph A->B->C and initial packages {A,C},
// we can ignore function bodies in B.
IgnoreFuncBodies: ld.Mode&NeedDeps == 0 && !lpkg.initial,

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 by packages.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 turn IgnoreFuncBodies on, everything works for me.

@gopherbot gopherbot added this to the Unreleased milestone Oct 10, 2019
@stamblerre stamblerre changed the title x/tools/packages: IgnoreFuncBodies implementation and comment mismatch x/tools/go/packages: IgnoreFuncBodies implementation and comment mismatch Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants