Skip to content

x/tools/gopls: nil pointer in LookupBuiltin #36975

@bearmingo

Description

@bearmingo

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

go version go1.13.7 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

O111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xxxxx/Library/Caches/go-build"
GOENV="/Users/xxxxx/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xxxxx/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.7/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xxxx/Work/Projects/sport-service-golang/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5_/v16pjnbx43g1j0z61f5h2z5w0000gn/T/go-build931873177=/tmp/go-build -gno-record-gcc-switches -fno-commo

What did you do?

When coding in VSCode, gopls crash repeatly
[Trace - 13:26:20.641 PM] Sending request 'textDocument/completion - (75)'.
Params: {"textDocument":{"uri":"file:///Users/xxxxx/Work/Projects/xxxxxxxxx/app/social/handlers/conversation.go"},"position":{"line":54,"character":3},"context":{"triggerKind":1}}

[Error - 13:26:20.655 PM] Received #75 method "textDocument/completion" did not reply

[Error - 1:26:20 PM] Request textDocument/completion failed.
Message: method "textDocument/completion" did not reply
Code: -32603
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1714c6f]

goroutine 7804 [running]:
golang.org/x/tools/internal/lsp/cache.(*view).LookupBuiltin(0xc00036c000, 0x1a550e0, 0xc001cfc8d0, 0x18f67d7, 0x4, 0x0, 0x0, 0x0)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/cache/view.go:209 +0x4f
golang.org/x/tools/internal/lsp/source.(*completer).formatBuiltin(0xc003304000, 0x1a68fc0, 0xc0000c4eb0, 0x3fed871fe1a40385, 0x18f67d7, 0x4, 0x0, 0x0, 0x0, 0x0, ...)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/source/completion_format.go:247 +0x2a5
golang.org/x/tools/internal/lsp/source.(*completer).item(0xc003304000, 0x1a68fc0, 0xc0000c4eb0, 0x3fed871fe1a40385, 0x18f67d7, 0x4, 0x0, 0x0, 0x0, 0x0, ...)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/source/completion_format.go:32 +0x187f
golang.org/x/tools/internal/lsp/source.(*completer).found(0xc003304000, 0x1a68fc0, 0xc0000c4eb0, 0x3fed871fe1a40385, 0x18f67d7, 0x4, 0x0, 0x0)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/source/completion.go:352 +0x2c4
golang.org/x/tools/internal/lsp/source.(*completer).lexical(0xc003304000, 0x0, 0x0)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/source/completion.go:873 +0x72a
golang.org/x/tools/internal/lsp/source.Completion(0x1a550e0, 0xc001cfc8d0, 0x1a651a0, 0xc001a5b200, 0x1a53120, 0xc001a5b1a0, 0x404b000000000000, 0x4008000000000000, 0x0, 0x0, ...)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/source/completion.go:536 +0xc3a
golang.org/x/tools/internal/lsp.(*Server).completion(0xc000229e30, 0x1a550e0, 0xc000c18930, 0xc002f04840, 0x0, 0x0, 0xc00df33970)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/completion.go:34 +0x744
golang.org/x/tools/internal/lsp.(*Server).Completion(0xc000229e30, 0x1a550e0, 0xc000c18930, 0xc002f04840, 0xc002f04840, 0x0, 0x0)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/server_gen.go:24 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0x1a730e0, 0xc000229e30, 0x1a550e0, 0xc000c18930, 0xc002007440, 0xc000c18900, 0xc00189cb90)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/lsp/protocol/tsserver.go:345 +0x241c
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc00bf8a240, 0xc002007440, 0xc000287800, 0x1a550e0, 0xc000c18930, 0x0, 0x0, 0xc004dbec50)
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/jsonrpc2/jsonrpc2.go:370 +0x170
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
/Users/xxxxxxx/go/pkg/mod/golang.org/x/tools@v0.0.0-20200130224948-02f1738cbe39/internal/jsonrpc2/jsonrpc2.go:354 +0x877
[Error - 1:26:20 PM] Connection to server got closed. Server will not be restarted.

What did you expect to see?

What did you see instead?

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