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

Closed ops-gaurav closed 5 months ago

ops-gaurav commented 5 months ago

gopls version: v0.15.2/go1.19.5 gopls flags: update flags: proxy extension version: 0.41.2 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Thu, 11 Apr 2024 11:56:44 GMT restart history: Thu, 11 Apr 2024 11:56:28 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

Getting the error on VSCode start and opening golang code directory

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

goroutine 9483 [running]:
go/types.NewChecker(0x0%3F, 0xc0031d4fc0, 0xc005602ff0, 0x0%3F)
      check.go:240  0x24e
golang.org/x/tools/gopls/internal/cache.(*analysisNode).typeCheck(0xc0023233f0, {0xc004feb878, 0x1, 0x1})
      analysis.go:1028  0x72c
golang.org/x/tools/gopls/internal/cache.(*analysisNode).run(0xc0023233f0, {0x1c855e0, 0xc0076647e0})
      analysis.go:810  0xd9
golang.org/x/tools/gopls/internal/cache.(*analysisNode).runCached(0xc0023233f0, {0x1c855e0%3F, 0xc0076647e0})
      analysis.go:672  0x145
golang.org/x/tools/gopls/internal/cache.(*Snapshot).Analyze.func6.1()
      analysis.go:398  0xda
golang.org/x/sync/errgroup.(*Group).Go.func1()
      errgroup.go:78  0x64
created by golang.org/x/sync/errgroup.(*Group).Go
      errgroup.go:75  0xa5
gopls stats -anon { "DirStats": { "Files": 3, "TestdataFiles": 0, "GoFiles": 1, "ModFiles": 1, "Dirs": 1 }, "GOARCH": "amd64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.19.5", "GoplsVersion": "v0.15.2", "InitialWorkspaceLoadDuration": "1.503617375s", "MemStats": { "HeapAlloc": 41984776, "HeapInUse": 65527808, "TotalAlloc": 521123512 }, "WorkspaceStats": { "Files": { "Total": 4374, "Largest": 395043, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.21.5", "AllPackages": { "Packages": 806, "LargestPackage": 1710, "CompiledGoFiles": 4370, "Modules": 8 }, "WorkspacePackages": { "Packages": 1, "LargestPackage": 1, "CompiledGoFiles": 1, "Modules": 1 }, "Diagnostics": 0 } ] } }
ops-gaurav commented 5 months ago

Fixed this by updating the gopl by going to Command + Shift + P > Install/ Update tools > Select gopl@latest This will update the Go Language server to latest version and will fix this error.