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: calling outgoingCalls from an var func panics #43376

leitzler opened this issue Dec 25, 2020 · 1 comment

x/tools/gopls: calling outgoingCalls from an var func panics #43376

leitzler opened this issue Dec 25, 2020 · 1 comment


Copy link

@leitzler leitzler commented Dec 25, 2020

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

$ go version
go version devel +6d2b3351f6 Thu Dec 10 18:34:40 2020 +0000 darwin/amd64
x/tools: v0.0.0-20201218024724-ae774e9781d2

Does this issue reproduce with the latest release?


What did you do?

With the cursor over first foo I called textDocument/prepareCallHierarchy and with the returned CallHierarchyItem as parameter callHierarchy/outgoingCalls.

package main

func main() {
    foo := func() {}

What did you expect to see?

The call to outgoingCalls return (no outgoing calls).

What did you see instead?

gopls crashes with a panic:

panic: ast.Walk: unexpected node type <nil>

goroutine 588 [running]:
go/ast.Walk(0x1adb740, 0xc0008ca360, 0x0, 0x0)
   /Users/leitzler/sdk/gotip/src/go/ast/walk.go:364 +0x30c6
   /Users/leitzler/sdk/gotip/src/go/ast/walk.go:385, 0xc0002e3ad0, 0x0, 0x0, 0x1aef7d8, 0xc00028c4e0, 0x4008000000000000, 0x3ff0000000000000, 0xc0008d0120)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/source/call_hierarchy.go:216 +0xc5, 0xc00077fda0, 0x1afd100, 0xc00057a000, 0x1aef7d8, 0xc00028c4e0, 0x4008000000000000, 0x3ff0000000000000, 0x0, 0x0, ...)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/source/call_hierarchy.go:201 +0x351*Server).outgoingCalls(0xc0001a8460, 0x1aebd38, 0xc0005a7600, 0xc0003f3200, 0x0, 0x0, 0x0, 0x0, 0x0)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/call_hierarchy.go:41 +0x179*Server).OutgoingCalls(0xc0001a8460, 0x1aebd38, 0xc0005a7600, 0xc0003f3200, 0xc0003f3200, 0x0, 0x0, 0x0, 0x0)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/server_gen.go:132 +0x4d, 0xc0005a7600, 0x1aff718, 0xc0001a8460, 0xc00077fd10, 0x1aebf30, 0xc0005a7580, 0x173093a, 0x1adafc0, 0xc000134010)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/protocol/tsserver.go:231 +0x45e5, 0xc0005a7600, 0xc00077fd10, 0x1aebf30, 0xc0005a7580, 0xbff15ad1e083af48, 0x361893def)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/protocol/protocol.go:63 +0xc5, 0xc0005a7600, 0xc00077fd10, 0x1aebf30, 0xc0005a7580, 0x0, 0x0)
   /Users/leitzler/proj/tools/outgoing_panic/internal/lsp/lsprpc/lsprpc.go:559 +0x452, 0xc0005a7600, 0xc00053b1d0, 0x1aebf30, 0xc0005a7580, 0x0, 0x0)
   /Users/leitzler/proj/tools/outgoing_panic/internal/jsonrpc2/handler.go:35 +0xd7, 0xc0008c94a0, 0xc000776170, 0x1aebd38, 0xc0005a7600, 0xc00053b1d0, 0x1aebf30, 0xc0005a7580)
   /Users/leitzler/proj/tools/outgoing_panic/internal/jsonrpc2/handler.go:103 +0x86
created by
   /Users/leitzler/proj/tools/outgoing_panic/internal/jsonrpc2/handler.go:100 +0x173

@gopherbot gopherbot added this to the Unreleased milestone Dec 25, 2020
Copy link

@gopherbot gopherbot commented Dec 25, 2020

Change mentions this issue: internal/lsp/source: do not panic in "var func" outgoing callhierarchy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants