golang / vscode-go

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

gopls: automated issue report (crash) #3324

Closed Petrie closed 5 months ago

Petrie commented 5 months ago

gopls version: v0.15.2/go1.22.1 gopls flags: update flags: proxy extension version: 0.41.2 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Tue, 09 Apr 2024 03:12:12 GMT restart history: Tue, 02 Apr 2024 11:15:20 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=0x88 pc=0x100fb55e0]

goroutine 52599 [running]:
golang.org/x/tools/internal/imports.(*ProcessEnv).ClearModuleInfo(0x140005623f0)
      mod.go:318  0x60
golang.org/x/tools/gopls/internal/cache.(*importsState).runProcessEnvFunc(0x14000390500, {0x1018046e8%3F, 0x1400ea24240%3F}, 0x1401cd905a0, 0x14009c0ade8)
      imports.go:164  0x22c
golang.org/x/tools/gopls/internal/cache.(*Snapshot).RunProcessEnvFunc(...)
      view.go:439
golang.org/x/tools/gopls/internal/golang.allImportsFixes({0x1018046e8%3F, 0x1400ea24120%3F}, 0x1401cd905a0, 0x1400f0b9490)
      format.go:118  0xc8
golang.org/x/tools/gopls/internal/golang.CodeActions({0x1018046e8, 0x1400ea24120}, 0x1401cd905a0, {0x101807100, 0x14010b7e480}, {{0x1cd905a0%3F, 0x140%3F}, {0x1ea4ae0%3F, 0x1%3F}}, {0x101ea4ae0, ...}, ...)
      codeaction.go:44  0x194
golang.org/x/tools/gopls/internal/server.(*server).CodeAction(0x14000242000, {0x101804720%3F, 0x1400ffab130%3F}, 0x140002a2070)
      code_action.go:117  0x4f0
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x101804720, 0x1400ffab130}, {0x10181dbe0, 0x14000242000}, 0x1400ea24030, {0x1018048e0, 0x1401c6ff140})
      tsserver.go:256  0x1dc8
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x101804720, 0x1400ffab130}, 0x1400ea24030, {0x1018048e0, 0x1401c6ff140})
      protocol.go:160  0x74
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x101804720, 0x1400ffab130}, 0x1400ea24030, {0x1018048e0, 0x1401c6ff140})
      lsprpc.go:509  0x6e0
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x101804720, 0x1400ffab130}, 0x1401c7585a0, {0x1018048e0, 0x1401c6ff140})
      handler.go:35  0xc0
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
      handler.go:103  0x90
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 121
      handler.go:100  0x19c
gopls stats -anon { "DirStats": { "Files": 8124, "TestdataFiles": 0, "GoFiles": 4339, "ModFiles": 2, "Dirs": 1728 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.1", "GoplsVersion": "v0.15.2", "InitialWorkspaceLoadDuration": "24.415542ms", "MemStats": { "HeapAlloc": 4535720, "HeapInUse": 7610368, "TotalAlloc": 57617016 }, "WorkspaceStats": { "Files": { "Total": 1, "Largest": 7040, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.1", "AllPackages": { "Packages": 0, "LargestPackage": 0, "CompiledGoFiles": 0, "Modules": 0 }, "WorkspacePackages": { "Packages": 0, "LargestPackage": 0, "CompiledGoFiles": 0, "Modules": 0 }, "Diagnostics": 0 } ] } }
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.
adonovan commented 5 months ago

Dup of https://github.com/golang/go/issues/66490 (fixed in gopls/v0.15.3-pre.1 which is available now)