golang / vscode-go

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

gopls: automated issue report (crash) #3417

Closed neversi closed 3 weeks ago

neversi commented 4 weeks ago

gopls version: v0.15.3/go1.21.5 gopls flags: update flags: proxy extension version: 0.41.4 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Fri, 31 May 2024 13:25:07 GMT restart history: Wed, 29 May 2024 09:19:08 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

While changing the variable name (globally in all project), there was instant crash of gopls

panic: instantiated ident not found

goroutine 6707 [running]:
go/types.(*Checker).handleBailout(0x14006440780, 0x14005475838)
      check.go:336  0x9c
panic({0x10514b880%3F, 0x1052c0b40%3F})
      panic.go:914  0x218
go/types.instantiatedIdent(...)
      check.go:594
go/types.(*Checker).recordInstance(0x1400546f7f8%3F, {0x1052c93d0%3F, 0x140058688c0%3F}, {0x14005dec9d0%3F, 0x14005dec9d0%3F, 0x1%3F}, {0x1052c62c8%3F, 0x14004e6fb00%3F})
      check.go:570  0x1e4
go/types.(*Checker).instantiateSignature(0x14006440780, 0xcdfbf, {0x1052c93d0, 0x140058688c0}, 0x14004e6fac0, {0x14005dec9d0, 0x1, 0x1}, {0x0, 0x0, ...})
      call.go:153  0x244
go/types.(*Checker).arguments(0x14006440780, 0x14005868900, 0x14004e6f940, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x14000b8bfc0%3F, ...}, ...)
      call.go:643  0x10bc
go/types.(*Checker).callExpr(0x14006440780, 0x14004e6f740, 0x14005868900)
      call.go:302  0x6a4
go/types.(*Checker).exprInternal(0x14006440780, {0x0, 0x0}, 0x14004e6f740, {0x1052c93d0, 0x14005868900%3F}, {0x0%3F, 0x0%3F})
      expr.go:1359  0x12e0
go/types.(*Checker).rawExpr(0x14006440780, {0x0, 0x0}, 0x14004e6f740, {0x1052c93d0%3F, 0x14005868900%3F}, {0x0%3F, 0x0%3F}, 0x0)
      expr.go:965  0x134
go/types.(*Checker).stmt(0x14006440780, 0x3, {0x1052c9790%3F, 0x1400585ba40%3F})
      stmt.go:397  0x144
go/types.(*Checker).stmtList(0x14006440780%3F, 0x3, {0x140054b3700%3F, 0x104e0c7a3%3F, 0x5%3F})
      stmt.go:124  0x88
go/types.(*Checker).stmt(0x14006440780, 0x3, {0x1052c9430%3F, 0x1400585f560%3F})
      stmt.go:565  0x1250
go/types.(*Checker).stmt(0x14006440780, 0x3, {0x1052c9760%3F, 0x1400583c8a0%3F})
      stmt.go:936  0x24e4
go/types.(*Checker).stmtList(0x14006440780%3F, 0x3, {0x140054b3780%3F, 0x104e0c7a3%3F, 0x5%3F})
      stmt.go:124  0x88
go/types.(*Checker).stmt(0x14006440780, 0x3, {0x1052c9430%3F, 0x1400585f5f0%3F})
      stmt.go:565  0x1250
go/types.(*Checker).stmt(0x14006440780, 0x0, {0x1052c9760%3F, 0x1400583c900%3F})
      stmt.go:936  0x24e4
go/types.(*Checker).stmtList(0x14007c1aa20%3F, 0x0, {0x14005868c40%3F, 0x0%3F, 0x14006684a98%3F})
      stmt.go:124  0x88
go/types.(*Checker).funcBody(0x14006440780, 0x14007abe0c0, {0x14005851dd0%3F, 0x1400004ecd0%3F}, 0x14004e4e200, 0x1400585f620, {0x0, 0x0})
      stmt.go:44  0x244
go/types.(*Checker).funcDecl.func1()
      decl.go:826  0x44
go/types.(*Checker).processDelayed(0x14006440780, 0x0)
      check.go:439  0x12c
go/types.(*Checker).checkFiles(0x14006440780, {0x14005a5fd80, 0xd, 0x10})
      check.go:383  0x1fc
go/types.(*Checker).Files(...)
      check.go:341
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).checkPackage(0x140069d20c0, {0x1052cace8, 0x140057de870}, 0x140067277a0)
      check.go:1532  0x850
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).handleSyntaxPackage(0x140069d20c0, {0x1052cace8%3F, 0x140057de870}, 0x14000ae94c0%3F, {0x14000ccbd50, 0x67})
      check.go:563  0x55c
golang.org/x/tools/gopls/internal/cache.(*Snapshot).forEachPackageInternal.func2()
      check.go:414  0x34
golang.org/x/sync/errgroup.(*Group).Go.func1()
      errgroup.go:78  0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 165
      errgroup.go:75  0x98
gopls stats -anon { "DirStats": { "Files": 8872, "TestdataFiles": 0, "GoFiles": 4338, "ModFiles": 2, "Dirs": 1115 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.21.5", "GoplsVersion": "v0.15.3", "InitialWorkspaceLoadDuration": "1.142580125s", "MemStats": { "HeapAlloc": 89678560, "HeapInUse": 142385152, "TotalAlloc": 1244250888 }, "WorkspaceStats": { "Files": { "Total": 3967, "Largest": 9586483, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.3", "AllPackages": { "Packages": 741, "LargestPackage": 155, "CompiledGoFiles": 4077, "Modules": 115 }, "WorkspacePackages": { "Packages": 119, "LargestPackage": 22, "CompiledGoFiles": 416, "Modules": 1 }, "Diagnostics": 6 } ] } }

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.

hyangah commented 3 weeks ago

Thanks @neversi This is a duplicate of https://github.com/golang/go/issues/63933 Can you use go1.22 to build the gopls? It is mitigated in 1.22.

The easiest way to rebuild the gopls with go1.22 is (since you are already with go1.21)

GOTOOLCHAIN=go1.22.3+auto go install golang.org/x/tools/gopls@latest 

You can still use go1.21 for your project with the gopls built with go1.22.

hyangah commented 3 weeks ago

Duplicate of golang/go#63933