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) #3325

Closed mchandler-plato closed 5 months ago

mchandler-plato commented 5 months ago

gopls version: v0.15.2/go1.22.0 gopls flags: update flags: proxy extension version: 0.41.2 environment: Visual Studio Code win32 initialization error: undefined issue timestamp: Tue, 09 Apr 2024 14:28:44 GMT restart history: Tue, 09 Apr 2024 12:56:27 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

swapping branches in git while vscode was open to the directory

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x88 pc=0x1537946]

goroutine 1336508 [running]:
golang.org/x/tools/internal/imports.(*ProcessEnv).ClearModuleInfo(0xc000377b90)
      mod.go:318  0x66
golang.org/x/tools/gopls/internal/cache.(*importsState).runProcessEnvFunc(0xc000234460, {0x1de84c8%3F, 0xc002dbdb90%3F}, 0xc00a968120, 0xc011956e10)
      imports.go:164  0x285
golang.org/x/tools/gopls/internal/cache.(*Snapshot).RunProcessEnvFunc(...)
      view.go:439
golang.org/x/tools/gopls/internal/golang.allImportsFixes({0x1de84c8%3F, 0xc002dbda10%3F}, 0xc00a968120, 0xc012d94850)
      format.go:118  0x11a
golang.org/x/tools/gopls/internal/golang.CodeActions({0x1de84c8, 0xc002dbda10}, 0xc00a968120, {0x1de97a0, 0xc0067171a0}, {{0x0%3F, 0x0%3F}, {0x0%3F, 0x0%3F}}, {0x24e2220, ...}, ...)
      codeaction.go:44  0x1df
golang.org/x/tools/gopls/internal/server.(*server).CodeAction(0xc000050300, {0x1de8500%3F, 0xc011068ff0%3F}, 0xc008571dc0)
      code_action.go:117  0x792
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x1de8500, 0xc011068ff0}, {0x1e03280, 0xc000050300}, 0xc002dbd950, {0x1de86c0, 0xc000e5e200})
      tsserver.go:256  0x23e7
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x1de8500, 0xc011068ff0}, 0xc002dbd950, {0x1de86c0, 0xc000e5e200})
      protocol.go:160  0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x1de8500, 0xc011068ff0}, 0xc002dbd950, {0x1de86c0, 0xc000e5e200})
      lsprpc.go:509  0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x1de8500, 0xc011068ff0}, 0xc00ac687e0, {0x1de86c0, 0xc000e5e200})
      handler.go:35  0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
      handler.go:103  0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 152
      handler.go:100  0x1c5
gopls stats -anon { "DirStats": { "Files": 4875, "TestdataFiles": 0, "GoFiles": 89, "ModFiles": 1, "Dirs": 325 }, "GOARCH": "amd64", "GOOS": "windows", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.0", "GoplsVersion": "v0.15.2", "InitialWorkspaceLoadDuration": "1.8413918s", "MemStats": { "HeapAlloc": 53427832, "HeapInUse": 92553216, "TotalAlloc": 805683928 }, "WorkspaceStats": { "Files": { "Total": 2615, "Largest": 945502, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.1", "AllPackages": { "Packages": 583, "LargestPackage": 148, "CompiledGoFiles": 2649, "Modules": 107 }, "WorkspacePackages": { "Packages": 45, "LargestPackage": 30, "CompiledGoFiles": 127, "Modules": 1 }, "Diagnostics": 5 } ] } }

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)