-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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/gopls: supress analysis/simplifycompositelit on a generated code #67733
Comments
Agreed, we should disable all "simplifiers" on generated code. |
Can i take this one? |
@idnandre Sure. We won't assign this to you, but if you chip in and send CLs, we will review them. (Take a look at https://go.dev/doc/contribute if you haven't before.) You probably want to wait for gopls to require a Go Version >= 1.21 e.g. for #65917 to close. After 1.21 is available the function ast.IsGenerated will be available. (You technically don't have to wait, but everything becomes about 4x harder. It requires create a library with built tags that makes sense both with and without go 1.21, and interprets "IsGenerated" in the correct direction whenever you use it when ast.IsGenerated is not available. Or duplicates the needed code. And write tests both before and after 1.21.) |
Hi @timothy-king Thank you. |
Change https://go.dev/cl/598835 mentions this issue: |
gopls version
go env
What did you do?
I have code that has been generated with
fmt.Printf("%#v",somestruct)
in files that are being properlymarked as such with
// Code generated with somegen DO NOT EDIT.
header in the first line.Gopls errornously suggests to simplify Printf produced literals polluting the "Problems"
pane in the IDE (while properly refusing to format file on save).
Repr:
What did you see happen?
hundreds of:
What did you expect to see?
I expected Gopls to know from the "Code generated" header that code here CAN NOT be simplified.
Editor and settings
Note:
simplifycompositelit
is by default true, but I had to have set it to false as a workaround now.Logs
No response
The text was updated successfully, but these errors were encountered: