I have code that has been generated with fmt.Printf("%#v",somestruct) in files that are being properly
marked 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:
// Code generated with somegen DO NOT EDIT.
package main
import "fmt"
type ProofOB struct{
A [][]string
}
func main(){
// x := ProofOB{A: [][]string{{"some value"}}}
x := ProofOB{A: [][]string{[]string{"some value"}}}
fmt.Printf("%#v\n",x)
}
// Result: main.ProofOB{A:[][]string{[]string{"some value"}}}
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 properly marked 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