golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 729 forks source link

gopls: automated issue report (crash) #3442

Closed kettlecat6 closed 1 day ago

kettlecat6 commented 3 days ago

gopls version: v0.13.2/go1.22.5 gopls flags: update flags: proxy extension version: 0.41.4 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Fri, 05 Jul 2024 07:28:55 GMT restart history: Fri, 05 Jul 2024 07:27:21 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1051dde68]

goroutine 2953 [running]:
golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0x14000c141c0, 0x37}, {0x14000c141c0, 0x37}, {0x14000c04194, 0xb}, {0x14001090c30, 0x1, 0x1}, {0x14001090c50, ...}, ...})
      check.go:1402  0x748
golang.org/x/tools/gopls/internal/lsp/cache.(*packageHandleBuilder).buildPackageHandle(0x140018236b0, {0x10574b7a0, 0x140032de3c0}, 0x140000c2190)
      check.go:1090  0x224
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).getPackageHandles.func2.1()
      check.go:891  0xb0
golang.org/x/sync/errgroup.(*Group).Go.func1()
      errgroup.go:75  0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 2931
      errgroup.go:72  0x98
gopls stats -anon gopls stats -anon failed after 301 ms. Please check if gopls is killed by OS.
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.
kettlecat6 commented 3 days ago

as far as my mac, gopls panics at every go projects..

CRSylar commented 3 days ago

same on Win11 and wsl

findleyr commented 1 day ago

Hi, thank you for the report. This is a duplicate of https://go.dev/issue/62191.

Your gopls version is quite old. Please upgrade to the latest version of gopls:

go install golang.org/x/tools/gopls@latest

Let us know if that doesn't fix the problem for you.