golang / vscode-go

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

gopls: automated issue report (crash) #3464

Closed beyildirim closed 1 month ago

beyildirim commented 1 month ago

gopls version: v0.16.1/go1.22.5 gopls flags: update flags: proxy extension version: 0.42.0 environment: Code - OSS linux initialization error: undefined issue timestamp: Sun, 21 Jul 2024 12:39:48 GMT restart history: Sun, 21 Jul 2024 12:30:08 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

No significant issues that affect me. It crashed while I was working with slices and a popup appeared.

Please attach the stack trace from the crash. A window with the error message should have popped up in the lower half of your screen. Please copy the stack trace and error messages from that window and paste it in this issue.

[Info - 3:39:38 PM] 2024/07/21 15:39:38 go/packages.Load #2 view_id="2" snapshot=0 directory=/home/user/exercism/go query=[/home/user/exercism/go/bird-watcher/... builtin] packages=4 duration=38.642635ms panic: /usr/lib/go/src/go/types/stmt.go:932: assertion failed [recovered] panic: /usr/lib/go/src/go/types/stmt.go:932: assertion failed goroutine 3630 [running]: go/types.(*Checker).handleBailout(0xc00227e400, 0xc000261898) /usr/lib/go/src/go/types/check.go:367 +0x88 panic({0xe9b560?, 0xc002786a10?}) /usr/lib/go/src/runtime/panic.go:770 +0x132 go/types.assert(0x0?) /usr/lib/go/src/go/types/errors.go:28 +0x54 go/types.(*Checker).rangeStmt(0xc00227e400, 0x3, 0xc0026c36e0) /usr/lib/go/src/go/types/stmt.go:932 +0xe70 go/types.(*Checker).stmt(0xc00227e400, 0x0, {0x1319688, 0xc0026c36e0}) /usr/lib/go/src/go/types/stmt.go:827 +0xab9 go/types.(*Checker).stmtList(0xc00227e400, 0x0, {0xc001f98700?, 0x0?, 0x0?}) /usr/lib/go/src/go/types/stmt.go:121 +0x85 go/types.(*Checker).funcBody(0xc00227e400, 0x1315b10?, {0xc001fa00b0?, 0x19aaae0?}, 0xc000c3c540, 0xc00110faa0, {0x0?, 0x0?}) /usr/lib/go/src/go/types/stmt.go:41 +0x331 go/types.(*Checker).funcDecl.func1() /usr/lib/go/src/go/types/decl.go:852 +0x3a go/types.(*Checker).processDelayed(0xc00227e400, 0x0) /usr/lib/go/src/go/types/check.go:467 +0x162 go/types.(*Checker).checkFiles(0xc00227e400, {0xc0009831c8, 0x1, 0x1}) /usr/lib/go/src/go/types/check.go:411 +0x1cc go/types.(*Checker).Files(...) /usr/lib/go/src/go/types/check.go:372 golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).checkPackage(0xc0026c3aa0, {0x131aa28, 0xc0018449c0}, 0xc000770360) /home/user/go/pkg/mod/golang.org/x/tools/gopls@v0.16.1/internal/cache/check.go:1543 +0xa25 golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).handleSyntaxPackage(0xc0026c3aa0, {0x131aa28, 0xc0018449c0}, 0x0, {0xc0005830d0, 0xb}) /home/user/go/pkg/mod/golang.org/x/tools/gopls@v0.16.1/internal/cache/check.go:568 +0x5e5 golang.org/x/tools/gopls/internal/cache.(*Snapshot).forEachPackageInternal.func2() /home/user/go/pkg/mod/golang.org/x/tools/gopls@v0.16.1/internal/cache/check.go:418 +0x2b golang.org/x/sync/errgroup.(*Group).Go.func1() /home/user/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:78 +0x56 created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 3565 /home/user/go/pkg/mod/golang.org/x/sync@v0.7.0/errgroup/errgroup.go:75 +0x96 [Error - 3:39:48 PM]

Failed to auto-collect gopls trace: no gopls log.

gopls stats -anon { "DirStats": { "Files": 103, "TestdataFiles": 0, "GoFiles": 26, "ModFiles": 13, "Dirs": 27 }, "GOARCH": "amd64", "GOOS": "linux", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.5", "GoplsVersion": "v0.16.1", "InitialWorkspaceLoadDuration": "11.536632ms", "MemStats": { "HeapAlloc": 1700736, "HeapInUse": 3522560, "TotalAlloc": 15699016 }, "WorkspaceStats": { "Files": { "Total": 0, "Largest": 0, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.5", "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.

findleyr commented 1 month ago

Thanks for the report. Can you please share the log you see in the gopls output channel and tell us when you observed this popup (e.g. I was updating gopls, I just opened the vscode, I did refactoring, ...)? Screen Shot 2021-01-27 at 2 53 49 PM

findleyr commented 1 month ago

Note that there is a known crash in the standard library in with Go 1.22.5 (golang/go#68334), so this may be fixed by the 1.22.6 release.

hyangah commented 1 month ago

Go 1.22.6 is released. Please rebuild gopls with Go 1.22.6.

GOTOOLCHAIN=go1.22.6 go install golang.org/x/tools/gopls@latest

And restart the gopls.