golang / vscode-go

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

gopls: automated issue report (crash) #3267

Closed yoedipaper closed 3 months ago

yoedipaper commented 3 months ago

gopls version: v0.15.2/go1.20.5 gopls flags: update flags: proxy extension version: 0.41.2 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Wed, 20 Mar 2024 12:19:03 GMT restart history: Wed, 20 Mar 2024 12:18:51 GMT: activation (enabled: true) Wed, 20 Mar 2024 12:19:04 GMT: installation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: invalid Go version "go1.21.4" (should be something like "go1.12")

goroutine 3716 [running]:
go/types.NewChecker(0x14005489a88%3F, 0x14005a63dc0, 0x14005dd3810, 0x0%3F)
      check.go:237  0x1e8
golang.org/x/tools/gopls/internal/cache.(*analysisNode).typeCheck(0x140029a7b80, {0x14006926f00, 0x7, 0x7})
      analysis.go:1028  0x5fc
golang.org/x/tools/gopls/internal/cache.(*analysisNode).run(0x140029a7b80, {0x101112998%3F, 0x14005e711d0})
      analysis.go:810  0x1d4
golang.org/x/tools/gopls/internal/cache.(*analysisNode).runCached(0x140029a7b80, {0x101112998%3F, 0x14005e711d0})
      analysis.go:672  0x104
golang.org/x/tools/gopls/internal/cache.(*Snapshot).Analyze.func6.1()
      analysis.go:398  0xa4
golang.org/x/sync/errgroup.(*Group).Go.func1()
      errgroup.go:78  0x5c
created by golang.org/x/sync/errgroup.(*Group).Go
      errgroup.go:75  0xa0
gopls stats -anon { "DirStats": { "Files": 546, "TestdataFiles": 0, "GoFiles": 184, "ModFiles": 1, "Dirs": 286 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.1", "GoplsVersion": "v0.15.2", "InitialWorkspaceLoadDuration": "1.999308041s", "MemStats": { "HeapAlloc": 84382776, "HeapInUse": 116801536, "TotalAlloc": 739601200 }, "WorkspaceStats": { "Files": { "Total": 2869, "Largest": 6161825, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.1", "AllPackages": { "Packages": 654, "LargestPackage": 155, "CompiledGoFiles": 2900, "Modules": 90 }, "WorkspacePackages": { "Packages": 89, "LargestPackage": 14, "CompiledGoFiles": 219, "Modules": 1 }, "Diagnostics": 2 } ] } }
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.
findleyr commented 3 months ago

Hi, we thought this crash was fixed with gopls@v0.15.2 (CC @adonovan), but in any case you can fix it by reinstalling gopls with a more recent version of Go (1.21 or 1.22).

Unfortunately, it's unlikely that we'll fix this bug with Go 1.20, since we are moving to a model where gopls is only compiled with the most recent version of go (see golang/go#65917).

Please open another issue if this isn't fixed by reinstalling gopls with a recent Go version.