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 internal/lsp/cache/imports.go #43544

Closed
voioc opened this issue Jan 6, 2021 · 3 comments
Closed

x/tools/gopls: panic in internal/lsp/cache/imports.go #43544

voioc opened this issue Jan 6, 2021 · 3 comments

Comments

@voioc
Copy link

@voioc voioc commented Jan 6, 2021

gopls version: v0.6.1
gopls flags:
extension version: 0.20.1
environment: Visual Studio Code

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: interface conversion: imports.Resolver is *imports.gopathResolver, not *imports.ModuleResolver

goroutine 32298 [running]:
golang.org/x/tools/internal/lsp/cache.(*importsState).runProcessEnvFunc(0xc000101a40, 0x1b2c040, 0xc00032bd10, 0xc0009400e0, 0xc000705c00, 0x0, 0x0)
	  imports.go:77  0x927
golang.org/x/tools/internal/lsp/cache.(*snapshot).RunProcessEnvFunc(0xc0009400e0, 0x1b2c040, 0xc00032bd10, 0xc000705c00, 0xc000cda540, 0x2)
	  view.go:326  0x56
golang.org/x/tools/internal/lsp/source.AllImportsFixes(0x1b2c040, 0xc00032bd10, 0x1b43760, 0xc0009400e0, 0x1b2fcc0, 0xc000cda540, 0x1b43700, 0xc0009400e0, 0x1b364a0, 0xc000cda540, ...)
	  format.go:97  0x34d
golang.org/x/tools/internal/lsp.(*Server).codeAction(0xc000152380, 0x1b2bf80, 0xc000b07600, 0xc000ae0500, 0x0, 0x0, 0x0, 0x0, 0x0)
	  code_action.go:85  0x1cbb
golang.org/x/tools/internal/lsp.(*Server).CodeAction(0xc000152380, 0x1b2bf80, 0xc000b07600, 0xc000ae0500, 0xc000ae0500, 0x0, 0x0, 0x0, 0x1b193a0)
	  server_gen.go:12  0x4d
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x1b2bf80, 0xc000b07600, 0x1b47a40, 0xc000152380, 0xc00032bc80, 0x1b2c1c0, 0xc000b07580, 0x0, 0x1b19280, 0xc00065c160)
	  tsserver.go:341  0x2054
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x1b2bf80, 0xc000b07600, 0xc00032bc80, 0x1b2c1c0, 0xc000b07580, 0x0, 0xbff5795da27a6e68)
	  protocol.go:63  0xc0
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x1b2bf80, 0xc000b07600, 0xc00032bc80, 0x1b2c1c0, 0xc000b07580, 0x0, 0x0)
	  lsprpc.go:559  0x420
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x1b2bf80, 0xc000b07600, 0xc000702be0, 0x1b2c1c0, 0xc000b07580, 0xc0007e67b0, 0x1)
	  handler.go:35  0xd3
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc000c86a20, 0xc000c11ce0, 0xc00038a0e0, 0x1b2bf80, 0xc000b07600, 0xc000702be0, 0x1b2c1c0, 0xc000b07580)
	  handler.go:103  0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x171
[Info  - 3:59:50 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>

@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: panic in internal/lsp/cache/imports.go Jan 6, 2021
@hyangah
Copy link
Contributor

@hyangah hyangah commented Jan 6, 2021

@voioc Thank you for the report. Transferring this to the go issue tracker.

@hyangah hyangah transferred this issue from golang/vscode-go Jan 6, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jan 6, 2021
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jan 6, 2021

/cc @heschik

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Jan 6, 2021
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Jan 6, 2021
@stamblerre stamblerre moved this from Needs Triage to Critical in vscode-go: gopls by default Jan 6, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 6, 2021

Change https://golang.org/cl/282113 mentions this issue: internal/lsp/cache: fix panic in GOPATH mode

vscode-go: gopls by default automation moved this from Critical to Done Jan 7, 2021
gopherbot pushed a commit to golang/tools that referenced this issue Jan 11, 2021
We can't assume that we're in module mode when we rebuild the imports
cache. (This is a long standing bug, but I suspect it was made more
common by my recent CL that refactored this code.)

Fixes golang/go#43544.

Change-Id: Ie35c43e6b6e496bd2fbf49cf9bf06c28cf1dab80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/282113
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants