Skip to content

x/tools/gopls: hide gofmt -s diagnostics (and others?) in generated files #38467

Closed
@zikaeroh

Description

@zikaeroh

Please answer these questions before submitting your issue. Thanks!

What did you do?

I generated code with gqlgen. One of the generated files (matches that DO NOT EDIT regex) contains non gofmt-simplified code.

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 gopls before in these files, so I'm not sure if it's a new issue or not.

#36914 seems related, but was specifically for staticcheck.

Build info

golang.org/x/tools/gopls master
    golang.org/x/tools/[email protected] h1:Ypqqmv003QzoDmadLMADUJ5LozvN33kS5Zr7zr+AtPU=
    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
    golang.org/x/[email protected] h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
    golang.org/x/[email protected] h1:FVw4lelfGRNPqB3C8qX1m+QyeM2vzToIwlFhEZX42y8=
    golang.org/x/[email protected] h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
    honnef.co/go/[email protected] h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/[email protected] h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.14.2 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions