Skip to content

x/tools/gopls: panic in completion on variables of type *error #56505

Closed
@Sophie1142

Description

@Sophie1142

gopls version: v0.10.0 (go1.19)
gopls flags:
update flags: proxy
extension version: 0.35.2
go version: 1.19
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Mon, 31 Oct 2022 23:27:13 GMT
restart history:
Mon, 31 Oct 2022 21:26:18 GMT: activation (enabled: true)
Mon, 31 Oct 2022 21:36:32 GMT: installation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

I got a pop-up notification from VSCode Gopls crashed, and then another one saying "Connection to server got closed. Server will not be restarted." This has not happened before in my ~2 months working with Go.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104f57374]

goroutine 138 [running]:
go/types.(*Package).Path(...)
	  package.go:31
golang.org/x/tools/gopls/internal/lsp/source/completion.isStarTestingDotF({0x10541e298%3F, 0x14009707640%3F})
	  completion.go:1283  0x74
golang.org/x/tools/gopls/internal/lsp/source/completion.(*completer).methodsAndFields(0x1400046e000, {0x10541e298%3F, 0x14009707640}, 0x1, 0x0, 0x14004a4ced0)
	  completion.go:1246  0x198
golang.org/x/tools/gopls/internal/lsp/source/completion.(*completer).deepSearch(0x1400046e000, {0x105422288%3F, 0x14002416f60%3F})
	  deep_completion.go:229  0x88c
golang.org/x/tools/gopls/internal/lsp/source/completion.Completion({0x105422218%3F, 0x1400030a780%3F}, {0x10542ddc0%3F, 0x140063dedc0}, {0x105422528%3F, 0x14000351960}, {0xeaf200%3F, 0x140%3F}, {0x2e1da40%3F, {0x0%3F, ...}})
	  completion.go:571  0xd6c
golang.org/x/tools/gopls/internal/lsp.(*Server).completion(0x14002cf69b0%3F, {0x105422218, 0x1400030a780}, 0x14002cf69b0)
	  completion.go:32  0x134
golang.org/x/tools/gopls/internal/lsp.(*Server).Completion(0x140002ae300%3F, {0x105422218%3F, 0x1400030a780%3F}, 0x1052b0e80%3F)
	  server_gen.go:28  0x24
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch({0x105422218, 0x1400030a780}, {0x1054311c0, 0x140001e0000}, 0x14002e1d620, {0x105422608, 0x1400030a700})
	  tsserver.go:269  0x1a24
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1({0x105422218, 0x1400030a780}, 0x14002e1d620, {0x105422608, 0x1400030a700})
	  protocol.go:157  0x6c
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1({0x105422218, 0x1400030a780}, 0x14002e1d620, {0x105422608%3F, 0x1400030a700%3F})
	  lsprpc.go:515  0x77c
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x105422218, 0x1400030a780}, 0x140002e9440, {0x105422608%3F, 0x1400030a700%3F})
	  handler.go:35  0xf0
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
	  handler.go:103  0x90
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x1dc
[Error - 4:27:01 PM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

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