Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: hide gofmt -s diagnostics (and others?) in generated files #38467
Please answer these questions before submitting your issue. Thanks!
What did you do?
I generated code with
What did you expect to see?
No non-syntax diagnostics; the file is generated.
What did you see instead?
Diagnostics like: "redundant type from array, slice, or map composite literal"
Since I have quick fix on save enabled, and some diagnostics have suggested fixes, if I save the file then I'll accidentally change the file even though it's generated.
Other linters (staticcheck, golangci-lint) will ignore these files, and I can't recall seeing messages from
#36914 seems related, but was specifically for staticcheck.
As suggested on Slack, a better fix for golang/go#38467 would be to hide suggested fixes on generated files. This way, the diagnostics are still visible but files are not unintentionally modified. Also, deleted the SuggestedFixes field on source.Diagnostic, since it's entirely unused. Change-Id: I10756471e0f913465b1cccd7f222eea0f4de77fe Reviewed-on: https://go-review.googlesource.com/c/tools/+/230999 Run-TryBot: Rebecca Stambler <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Heschi Kreinick <firstname.lastname@example.org>