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

Handle recursive fieldpropagators #253

Open
mlevesquedion opened this issue Jan 5, 2021 · 0 comments
Open

Handle recursive fieldpropagators #253

mlevesquedion opened this issue Jan 5, 2021 · 0 comments

Comments

@mlevesquedion
Copy link
Contributor

The fieldpropagator analyzer currently does not identify fieldpropagators that get their fields from another fieldpropagator, e.g. :

type Source struct { secret string }

func (s Source) Secret() string {
    return s.secret
}

func (s Source) FormattedSecret() string {
    return "the secret is: " + s.Secret()
}

The above example is admittedly a bit frivolous. I'm not sure how common these are.

The analysis is fact-based, so if a method has already been analyzed, its status as a fieldpropagator can be checked by calling pass.ImportObjectFact(obj, &isFieldPropagator{}).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant