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 stubmethods with variadic args #61693

Closed
danilotadeu opened this issue Jul 31, 2023 · 3 comments
Closed

x/tools/gopls: panic in stubmethods with variadic args #61693

danilotadeu opened this issue Jul 31, 2023 · 3 comments
Labels
gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@danilotadeu
Copy link

gopls version: v0.13.0 (go1.20.6)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.20.6
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Mon, 31 Jul 2023 23:39:18 GMT
restart history:
Mon, 31 Jul 2023 23:18:53 GMT: activation (enabled: true)
Mon, 31 Jul 2023 23:20:16 GMT: installation (enabled: true)
Mon, 31 Jul 2023 23:21:47 GMT: installation (enabled: true)
Mon, 31 Jul 2023 23:23:47 GMT: manual (enabled: true)
Mon, 31 Jul 2023 23:26:15 GMT: manual (enabled: true)
Mon, 31 Jul 2023 23:38:48 GMT: installation (enabled: true)
Mon, 31 Jul 2023 23:39:02 GMT: manual (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: index out of range [3] with length 1

goroutine 133 [running]:
go/types.(*Tuple).At(...)
	  tuple.go:31
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.fromCallExpr(0x140045f34c0, 0x1400419da90, 0x3e1, 0x1400295dc80)
	  stubmethods.go:177  0x384
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.GetStubInfo(0x1400295f170%3F, 0x3e1%3F, {0x14000242500%3F, 0x6, 0x8}, 0x1017a8d00%3F)
	  stubmethods.go:141  0xb0
golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods.DiagnosticForError(0x14000392770%3F, 0x140003fe9c0%3F, 0x3e1, 0x429, {0x140001d6e00%3F, 0x6f%3F}, 0x14000782f20%3F)
	  stubmethods.go:85  0x88
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction(0x1400001b960%3F, {0x1017e2900%3F, 0x140000c25a0%3F}, 0x1400001b960)
	  code_action.go:206  0xee8
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction(0x1400027c000%3F, {0x1017e2900%3F, 0x140000c25a0%3F}, 0x1016632a0%3F)
	  server_gen.go:16  0x24
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch({0x1017e2900, 0x140000c25a0}, {0x1017f2428, 0x140004802a0}, 0x140003fe330, {0x1017e2bd8, 0x14000690240})
	  tsserver.go:239  0x18cc
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1({0x1017e2900, 0x140000c25a0}, 0x140003fe330, {0x1017e2bd8, 0x14000690240})
	  protocol.go:157  0x6c
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1({0x1017e2900, 0x140000c25a0}, 0x140003fe330, {0x1017e2bd8%3F, 0x14000690240%3F})
	  lsprpc.go:519  0x768
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1017e2900, 0x140000c25a0}, 0x140002a1158, {0x1017e2bd8%3F, 0x14000690240%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 - 20:39:05] 

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>

@findleyr findleyr changed the title gopls: automated issue report (crash) x/tools/gopls: panic in stubmethods with mismatched args and params Aug 1, 2023
@findleyr
Copy link
Contributor

findleyr commented Aug 1, 2023

Thanks very much for the report. I can see the logic error.

This bug has been latent for a long time, but in the refactoring of this operation to not use the analysis framework we lost the panic recovery included in analysis.

@findleyr findleyr transferred this issue from golang/vscode-go Aug 1, 2023
@findleyr findleyr added this to the gopls/v0.13.1 milestone Aug 1, 2023
@findleyr findleyr added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 1, 2023
@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 Aug 1, 2023
@findleyr
Copy link
Contributor

findleyr commented Aug 1, 2023

I stand corrected: it is simply not handling variadic parameters correctly.

@findleyr findleyr changed the title x/tools/gopls: panic in stubmethods with mismatched args and params x/tools/gopls: panic in stubmethods with variadic args Aug 1, 2023
@gopherbot
Copy link

Change https://go.dev/cl/514755 mentions this issue: gopls/internal/lsp/analysis: fix stubmethods with variadic parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. 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