Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: panic in internal/lsp/source.pathLinkAndSymbolName #40479

Closed
danp opened this issue Jul 29, 2020 · 6 comments
Closed

x/tools/gopls: panic in internal/lsp/source.pathLinkAndSymbolName #40479

danp opened this issue Jul 29, 2020 · 6 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@danp
Copy link
Contributor

danp commented Jul 29, 2020

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

$ go version
go version devel +c4fed25553 Mon Jul 27 18:24:32 2020 +0000 darwin/amd64

Using gopls built from golang/tools@df70183

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

macOS, Emacs 26.3, lsp-mode 20200726.1814

What did you do?

Moved my cursor over the method name in a method declaration, such as Bar in:

func (f *foo) Bar(ctx context.Context, req *api.BarRequest) (*api.BarResponse, error) {

What did you expect to see?

Nothing, or maybe an info hover.

What did you see instead?

panic: interface conversion: types.Type is nil, not *types.Named

goroutine 14963 [running]:
golang.org/x/tools/internal/lsp/source.pathLinkAndSymbolName(0xc01a362360, 0xc00fc8bbd0, 0xc00e73c1e0, 0xc000c9d500, 0x6b, 0xc00f49e201, 0x1)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/source/hover.go:169 +0xe18
golang.org/x/tools/internal/lsp/source.HoverIdentifier(0x1ab0460, 0xc00e72a420, 0xc01a362360, 0x0, 0x0, 0x0)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/source/hover.go:112 +0x272
golang.org/x/tools/internal/lsp/source.Hover(0x1ab03a0, 0xc00f1ccac0, 0x1ac06c0, 0xc017436a20, 0x1ab3fe0, 0xc018733260, 0x4075600000000000, 0x403c000000000000, 0x1ab3fe0, 0xc018733260, ...)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/source/hover.go:56 +0xe5
golang.org/x/tools/internal/lsp.(*Server).hover(0xc0003382d0, 0x1ab03a0, 0xc00f1ccac0, 0xc00e72a030, 0x0, 0x0, 0xc001dca420)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/hover.go:24 +0x216
golang.org/x/tools/internal/lsp.(*Server).Hover(0xc0003382d0, 0x1ab03a0, 0xc00f1ccac0, 0xc00e72a030, 0xc00e72a030, 0x0, 0x0)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/server_gen.go:96 +0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x1ab03a0, 0xc00f1ccac0, 0x1ac3c40, 0xc0003382d0, 0xc00e72a000, 0x1ab05e0, 0xc00f1cc900, 0x1a9dce0, 0xc001dca000, 0x1ab0460)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/protocol/tsserver.go:269 +0x16b2
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x1ab03a0, 0xc00f1ccac0, 0xc00e72a000, 0x1ab05e0, 0xc00f1cc900, 0x1f00960, 0x1aae760)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/protocol/protocol.go:62 +0xc5
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x1ab03a0, 0xc00f1ccac0, 0xc00e72a000, 0x1ab05e0, 0xc00f1cc900, 0x0, 0x0)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/lsp/lsprpc/lsprpc.go:521 +0x432
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x1ab03a0, 0xc00f1ccac0, 0xc00e5f2c00, 0x1ab05e0, 0xc00f1cc900, 0x0, 0x10000c000746f60)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/jsonrpc2/handler.go:35 +0xcf
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc00c4f16e0, 0xc00e4fdce0, 0xc000334e10, 0x1ab03a0, 0xc00f1ccac0, 0xc00e5f2c00, 0x1ab05e0, 0xc00f1cc900)
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	/Users/dan.peterson/Projects/go/src/golang.org/x/tools/internal/jsonrpc2/handler.go:100 +0x173

Process gopls stderr<1> finished
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jul 29, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 29, 2020
@danp
Copy link
Contributor Author

danp commented Jul 29, 2020

Maybe a dup of or related to #40464?

@stamblerre
Copy link
Contributor

Yep I think so. Should be fixed in the latest pre-release (gopls/v0.4.4-pre2).

@danp
Copy link
Contributor Author

danp commented Jul 29, 2020

Just to double check: this is happening at golang/tools@df70183, which if I understand correctly includes everything v0.4.4-pre2 does. I did just try again after explicitly checking out gopls/v0.4.4-pre2 and I'm still getting the same panic.

@stamblerre
Copy link
Contributor

Oh no, I didn't realize it was still happening. This is proving quite tricky to track down - I'll keep looking.

@stamblerre stamblerre reopened this Jul 29, 2020
@gopherbot
Copy link

Change https://golang.org/cl/245486 mentions this issue: internal/lsp: avoid nil interface bug in searchForEnclosing

@gopherbot
Copy link

Change https://golang.org/cl/245538 mentions this issue: [gopls-release-branch.0.4] internal/lsp: properly check for nil on i.enclosing

gopherbot pushed a commit to golang/tools that referenced this issue Jul 29, 2020
…enclosing

Fixes golang/go#40479

Change-Id: If827a86fd603574d3adde295c1165bb6267732eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245486
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
(cherry picked from commit 449c585)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/245538
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
@golang golang locked and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants