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/analysis/passes/fieldalignment/cmd/fieldalignment: ignore generated files #60509
Comments
My intuition is that a lot of users would have the opposite desire from I am slightly unsure about the technical feasibility. IIUC whether a file is generated is not a part of the We could get this from the user, but at the point that is roughly equivalent to just having a flag for which files to exclude from reports. FWIW it is relatively straightforward to postprocess the -json output to exclude files. So it is unclear if we x/tools/go/analysis really is the thing to be updated. |
A lot of people use code generators they have little control over,
I'm not sure if I understand the question correctly, but the convention is documented in
This is to be added in Go 1.21 with |
TIL! Great to know there is a standard. (This function would need to be copied for I think there is a question of whether such a flag should be on a checker or if it should be generalized to the driver level, e.g. unitchecker, singlechecker or gopls. @adonovan @findleyr thoughts? |
In fact, this function evolved from the version in x/tools (see gopls/internal/lsp/source/util.go) though the go/ast version is much better (in large part due to @dmitshur's careful review).
Applying edits is certainly a driver responsibility. Our drivers should not apply edits to generated files, or, for that matter, to read-only files such as those in the module cache, nor apply edits twice due to file-system level aliasing such as symbolic and hard links. |
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?
(The package containing generated code in
generated.pb.go
.)What did you expect to see?
Nothing, exit code
0
.What did you see instead?
Exit code
3
.The text was updated successfully, but these errors were encountered: