go
go copied to clipboard
x/tools/gopls: crash in adjustRangeForCommentsAndWhiteSpace
gopls version: (devel) (go1.19.1) gopls flags: -rpc.trace update flags: proxy extension version: 0.35.2 go version: 1.19.1 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Tue, 20 Sep 2022 17:55:50 GMT restart history: Tue, 20 Sep 2022 17:53:55 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
panic: runtime error: index out of range [1] with length 1
goroutine 2418 [running]:
golang.org/x/tools/gopls/internal/lsp/source.adjustRangeForCommentsAndWhiteSpace({0xc003478540, 0x6f8735, 0x6f8737}, 0xc003478540, {0xc00032d500, 0x505, 0xa80}, 0xc0023f2b80)
extract.go:679 0x774
golang.org/x/tools/gopls/internal/lsp/source.CanExtractFunction(0xc003478540, {0xc003478540, 0x6f8735, 0x6f8737}, {0xc00032d500, 0x505, 0xa80}, 0xc0023f2b80)
extract.go:984 0x1d3
golang.org/x/tools/gopls/internal/lsp.extractionFixes({0x2123898, 0xc00065c100}, {0x212d3c0, 0xc000002140}, {0x212b730, 0xc0004ea600}, {0xc001e1e360, 0x28}, {{0x22, 0xa}, ...})
code_action.go:306 0x5f8
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction(0xc000480360, {0x2123898, 0xc00065c100}, 0xc001bc8000)
code_action.go:201 0x2dc8
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction(0xc000480360, {0x2123898, 0xc00065c100}, 0xc001bc8000)
server_gen.go:16 0x95
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch({0x2123898, 0xc00065c100}, {0x2131160, 0xc000480360}, 0xc0009c8000, {0x2123c50, 0xc00065c040})
tsserver.go:239 0x492d
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1({0x2123898, 0xc00065c100}, 0xc0009c8000, {0x2123c50, 0xc00065c040})
protocol.go:157 0x14e
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1({0x2123898, 0xc00065c100}, 0xc0009c8000, {0x2123c50, 0xc00065c040})
lsprpc.go:515 0xeae
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x2123898, 0xc00065c100}, 0xc001a76318, {0x2123c50, 0xc00065c040})
handler.go:35 0x152
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
handler.go:103 0xc3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
handler.go:100 0x2cc
[Error - 1:55:27 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>
Thanks for following up!
Change https://go.dev/cl/432135 mentions this issue: gopls: fix out of bounds bug in extract