-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
This is a proposal to add an option to analysis.Analyzer to declare its disinterest in generated files. Since such files' contents are not directly within the user's control, it may be better for an analyzer to ignore them.
For example, we have converted ineffassign, which checks for ineffectual assignments, into an Analyzer. Such ineffectual assignments are not always indicative of an error but only sloppiness, which sometimes a code generator ought to be allowed to get away with.
Previously, we were using dmitri.shuralyov.com/go/generated, which checks if a file has a comment like // Code generated _ DO NOT EDIT.
, but now we scan Pass.Files[i].Comments
rather than reading each whole file again.
Anyway, this proposal is to add a field Analyzer.IgnoreGeneratedFiles
which, if true, would result in those files not being present in Pass.Files
.