Skip to content

x/tools/gopls: should not issue lint-style warnings on generated code #41436

Open
@mgabeler-lee-6rs

Description

@mgabeler-lee-6rs

What version of Go are you using (go version)?

$ go version
go version go1.14.7 linux/amd64

$ gopls version
golang.org/x/tools/gopls v0.5.0
    golang.org/x/tools/[email protected] h1:XEmO9RylgmaXp33iGrWfCGopVYDGBmLy+KmsIsfIo8Y=

Does this issue reproduce with the latest release?

This is the latest release of gopls as far as I can tell

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mgabeler-lee/.cache/go-build"
GOENV="/home/mgabeler-lee/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mgabeler-lee/src/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/mgabeler-lee/src/noneofyourbusiness/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build340320309=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  • Made a project that has generated code from go-bindata
  • Loaded the project in vscode with the go extension and gopls enabled
  • OR: Just ran gopls check .../foo.go for all the files in the project

What did you expect to see?

  • No style/format warnings for a file with a standard generated code header (// Code generated for package foo by go-bindata DO NOT EDIT. (@generated)

What did you see instead?

  • .../foo.go:306:27-35: redundant type from array, slice, or map composite literal
    • The vscode warning adds that this is from the simplifycompositelit check
  • I do see those warnings, and can't get rid of them since ... it's generated code

Metadata

Metadata

Assignees

No one assigned

    Labels

    ThinkingToolsThis 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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions