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: crash in template.weakMatch #50430

Closed
doug4j opened this issue Dec 23, 2021 · 4 comments
Closed

x/tools/gopls: crash in template.weakMatch #50430

doug4j opened this issue Dec 23, 2021 · 4 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@doug4j
Copy link

doug4j commented Dec 23, 2021

gopls version: v0.7.4
gopls flags:
update flags: proxy
extension version: 0.30.0
go version: 1.17.5
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Thu, 23 Dec 2021 22:39:37 GMT
restart history:
Thu, 23 Dec 2021 14:29:56 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

In editing a loop within a go template (a file whose extension is ".tmpl"), received the following crash. I was editing items with a {{range ...}} clause.

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

goroutine 17190 [running]:
golang.org/x/tools/internal/lsp/template.weakMatch({0x1400f37ec90, 0x1}, {0x1400e980090, 0x2})
	  completion.go:278  0x164
golang.org/x/tools/internal/lsp/template.(*completer).complete(0x140161fef00)
	  completion.go:137  0x27c
golang.org/x/tools/internal/lsp/template.Completion({0x10528be58, 0x1401dbf8480}, {0x1052b1040, 0x1400e2c0200}, {0x10529f770, 0x140115b5ec0}, {0x15a, 0x106}, {0x3ff0000000000000, {0x0, ...}})
	  completion.go:58  0x2c4
golang.org/x/tools/internal/lsp.(*Server).completion(0x14000112480, {0x10528be58, 0x1401dbf8480}, 0x1401d7c8a00)
	  completion.go:37  0x188
golang.org/x/tools/internal/lsp.(*Server).Completion(0x14000112480, {0x10528be58, 0x1401dbf8480}, 0x1401d7c8a00)
	  server_gen.go:32  0x40
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x10528be58, 0x1401dbf8480}, {0x1052b4e70, 0x14000112480}, 0x1401acf0060, {0x10528c0c0, 0x1401dbf8400})
	  tsserver.go:398  0x1e88
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x10528be58, 0x1401dbf8480}, 0x1401acf0060, {0x10528c0c0, 0x1401dbf8400})
	  protocol.go:154  0x84
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x10528be58, 0x1401dbf8480}, 0x1401acf0060, {0x10528c0c0, 0x1401dbf8400})
	  lsprpc.go:506  0x8a4
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x10528be58, 0x1401dbf8480}, 0x1400aeeb1d0, {0x10528c0c0, 0x1401dbf8400})
	  handler.go:35  0xf4
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0x14015274c00, 0x1401ace6420, 0x1400014ceb0, {0x10528be58, 0x1401dbf8480}, 0x1400aeeb1d0, {0x10528c0c0, 0x1401dbf8400})
	  handler.go:103  0x6c
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x15c
[Error - 5:39:19 PM] 

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

@findleyr
Copy link
Contributor

findleyr commented Jan 4, 2022

Thank you for the report.

Transfering to the gopls issue tracker.
CC @pjweinb

@findleyr findleyr changed the title Jan 4, 2022
@findleyr findleyr transferred this issue from golang/vscode-go Jan 4, 2022
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jan 4, 2022
@findleyr findleyr added this to the gopls/v0.7.5 milestone Jan 4, 2022
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jan 4, 2022
@gopherbot gopherbot modified the milestones: gopls/v0.7.5, Unreleased Jan 4, 2022
@findleyr findleyr added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 4, 2022
@pjweinb
Copy link

pjweinb commented Jan 4, 2022

Thank you. Do you happen to remember the exact string that caused it?

@pjweinb pjweinb self-assigned this Jan 4, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.7.5 Jan 4, 2022
@gopherbot
Copy link

Change https://golang.org/cl/375454 mentions this issue: templates: fix panic, and stop complaining about empty files

@doug4j
Copy link
Author

doug4j commented Jan 10, 2022

Regarding #50430 (comment) , no, I don't have the original text (state of that text) that caused the error. All I can say is I was editing a template and in doing so gopls crashed. Thanks all for looking at this. Love the work you're doing. Thank you so much!

@rsc rsc unassigned pjweinb Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants