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 saving file #35604

Closed
muirdm opened this issue Nov 15, 2019 · 2 comments
Closed

x/tools/gopls: panic saving file #35604

muirdm opened this issue Nov 15, 2019 · 2 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

@muirdm
Copy link

muirdm commented Nov 15, 2019

I see a panic when saving the below file contents:

package foo
import "fmt"
panic: illegal line number

goroutine 1587 [running]:
go/token.(*File).LineStart(0xc00260eb40, 0xb, 0x0)
	/usr/local/go/src/go/token/position.go:222 +0xf6
golang.org/x/tools/internal/lsp/source.trimToImports(0xc000286980, 0xc001be3c80, 0xc000100c60, 0x144, 0x160, 0x0, 0x0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/source/format.go:289 +0x18a
golang.org/x/tools/internal/lsp/source.computeImportEdits(0x19b32c0, 0xc00175bbf0, 0x19c5040, 0xc0003a6000, 0x19b3580, 0xc001e888c0, 0xc001662640, 0x0, 0x0, 0x0, ...)
	/Users/muir/projects/tools/internal/lsp/source/format.go:163 +0x23c
golang.org/x/tools/internal/lsp/source.AllImportsFixes.func1(0xc001662640, 0xc00175bb00, 0x17214a0)
	/Users/muir/projects/tools/internal/lsp/source/format.go:139 +0x97
golang.org/x/tools/internal/lsp/cache.(*view).RunProcessEnvFunc(0xc0003a6000, 0x19b32c0, 0xc00175bbf0, 0xc0007d70e0, 0xc001662640, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/view.go:175 +0xf6
golang.org/x/tools/internal/lsp/source.AllImportsFixes(0x19b32c0, 0xc00175bbf0, 0x19c5040, 0xc0003a6000, 0x27610d8, 0xc0001a7e80, 0x0, 0x2, 0x0, 0x100, ...)
	/Users/muir/projects/tools/internal/lsp/source/format.go:138 +0x7a2
golang.org/x/tools/internal/lsp.(*Server).codeAction(0xc00028a960, 0x19b32c0, 0xc00175bb30, 0xc000190150, 0xc000190150, 0x0, 0x0, 0x0, 0xc001bb5550)
	/Users/muir/projects/tools/internal/lsp/code_action.go:72 +0x7ee
golang.org/x/tools/internal/lsp.(*Server).CodeAction(0xc00028a960, 0x19b32c0, 0xc00175bb30, 0xc000190150, 0xc000190150, 0x0, 0x0, 0xc000314bf8, 0x1046f6c)
	/Users/muir/projects/tools/internal/lsp/server.go:201 +0x4d
golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0x19cc840, 0xc00028a960, 0x19b32c0, 0xc00175bb30, 0xc000ff3040, 0xc00175bb00, 0xc0007d7040)
	/Users/muir/projects/tools/internal/lsp/protocol/tsserver.go:398 +0x240d
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc000d30660, 0xc000ff3040, 0xc00028a9c0, 0x19b32c0, 0xc00175bb30, 0x0, 0x0, 0xc001bca1d0)
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:370 +0x170
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:354 +0x877
@gopherbot gopherbot added this to the Unreleased milestone Nov 15, 2019
@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 Nov 15, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@muirdm muirdm changed the title x/tools/gopls: panic saving file with cursor after import x/tools/gopls: panic saving file Nov 15, 2019
@heschi heschi self-assigned this Nov 15, 2019
@gopherbot
Copy link

Change https://golang.org/cl/208672 mentions this issue: internal/lsp/source: fix crash on short file

@golang golang locked and limited conversation to collaborators Nov 24, 2020
@rsc rsc unassigned heschi Jun 23, 2022
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