Skip to content

x/tools/gopls: crash due to fixed ast.Node.End beyond EOF #66790

@nobelsmith

Description

@nobelsmith

gopls version: v0.15.2/go1.22.1
gopls flags:
update flags: proxy
extension version: 0.41.2
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Fri, 05 Apr 2024 20:02:00 GMT
restart history:
Thu, 04 Apr 2024 19:08:50 GMT: activation (enabled: true)
Fri, 05 Apr 2024 17:57:26 GMT: manual (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: file not found for pos = 1 (-)

goroutine 21096 [running]:
go/types.(*Checker).handleBailout(0x14005c32000, 0x140073eb878)
	  check.go:367  0x9c
panic({0x1014ecbe0%3F, 0x140072e0b40%3F})
	  panic.go:770  0x124
go/types.(*Checker).fileFor(0x14005c32000, 0x1)
	  version.go:131  0x154
go/types.(*Checker).allowVersion(0x14005c32000, 0x101566700%3F, {0x101669480%3F, 0x140062a46a0%3F}, {0x1011a8a18, 0x6})
	  version.go:97  0x64
go/types.(*Checker).genericExprList(0x14005c32000, {0x140062a4720, 0x2, 0x140062a4640%3F})
	  call.go:383  0xb64
go/types.(*Checker).callExpr(0x14005c32000, 0x140028bb480, 0x14001816600)
	  call.go:303  0x560
go/types.(*Checker).exprInternal(0x14005c32000, 0x0, 0x140028bb480, {0x10166eda8, 0x14001816600}, {0x0, 0x0})
	  expr.go:1374  0xd0
go/types.(*Checker).rawExpr(0x14005c32000, 0x0, 0x140028bb480, {0x10166eda8%3F, 0x14001816600%3F}, {0x0%3F, 0x0%3F}, 0x0)
	  expr.go:979  0x12c
go/types.(*Checker).suspendedCall(0x14005c32000, {0x1011a5052, 0x2}, 0x14001816600)
	  stmt.go:173  0x64
go/types.(*Checker).stmt(0x14005c32000, 0x7, {0x10166f528, 0x140042f74c0})
	  stmt.go:499  0xe38
go/types.(*Checker).stmtList(0x14005c32000, 0x7, {0x140062a4740%3F, 0x1011a5ff9%3F, 0x4%3F})
	  stmt.go:121  0x88
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166f0a8, 0x140067a73b0})
	  stmt.go:628  0x249c
go/types.(*Checker).stmtList(0x14005c32000, 0x3, {0x140060b2b80%3F, 0x1011a7620%3F, 0x5%3F})
	  stmt.go:121  0x88
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166ee08, 0x140067a73e0})
	  stmt.go:562  0x1974
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166edd8, 0x140018167c0})
	  stmt.go:574  0x258c
go/types.(*Checker).stmtList(0x14005c32000, 0x3, {0x140042f7510%3F, 0x1011a7620%3F, 0x5%3F})
	  stmt.go:121  0x88
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166ee08, 0x140067a7410})
	  stmt.go:562  0x1974
go/types.(*Checker).rangeStmt(0x14005c32000, 0x3, 0x140042dbbc0)
	  stmt.go:970  0x580
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166f138, 0x140042dbbc0})
	  stmt.go:827  0x874
go/types.(*Checker).stmtList(0x14005c32000, 0x3, {0x140042f7520%3F, 0x1011a7620%3F, 0x5%3F})
	  stmt.go:121  0x88
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166ee08, 0x140067a7440})
	  stmt.go:562  0x1974
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166edd8, 0x14001816800})
	  stmt.go:574  0x258c
go/types.(*Checker).stmtList(0x14005c32000, 0x3, {0x140060b2c80%3F, 0x1011a7620%3F, 0x5%3F})
	  stmt.go:121  0x88
go/types.(*Checker).stmt(0x14005c32000, 0x3, {0x10166ee08, 0x140067a7650})
	  stmt.go:562  0x1974
go/types.(*Checker).stmt(0x14005c32000, 0x0, {0x10166f108, 0x14001816bc0})
	  stmt.go:823  0x2034
go/types.(*Checker).stmtList(0x14005c32000, 0x0, {0x14000871900%3F, 0x0%3F, 0x140039f3eec%3F})
	  stmt.go:121  0x88
go/types.(*Checker).funcBody(0x14005c32000, 0x10166ba18%3F, {0x140039f3fb0%3F, 0x101c810c0%3F}, 0x14002abc140, 0x140067a7680, {0x0%3F, 0x0%3F})
	  stmt.go:41  0x21c
go/types.(*Checker).funcDecl.func1()
	  decl.go:852  0x44
go/types.(*Checker).processDelayed(0x14005c32000, 0x0)
	  check.go:467  0x12c
go/types.(*Checker).checkFiles(0x14005c32000, {0x14002885100, 0x7, 0x8})
	  check.go:411  0x188
go/types.(*Checker).Files(...)
	  check.go:372
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).checkPackage(0x140064fe660, {0x1016706e8, 0x140070c02a0}, 0x140038486c0)
	  check.go:1532  0x764
golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).handleSyntaxPackage(0x140064fe660, {0x1016706e8, 0x140070c02a0}, 0x0, {0x140008dc120, 0x24})
	  check.go:563  0x534
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 20851
	  errgroup.go:75  0x98
gopls stats -anon { "DirStats": { "Files": 805, "TestdataFiles": 0, "GoFiles": 41, "ModFiles": 1, "Dirs": 322 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.1", "GoplsVersion": "v0.15.2", "InitialWorkspaceLoadDuration": "708.152041ms", "MemStats": { "HeapAlloc": 33689896, "HeapInUse": 51576832, "TotalAlloc": 551701312 }, "WorkspaceStats": { "Files": { "Total": 1850, "Largest": 935931, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.1", "AllPackages": { "Packages": 307, "LargestPackage": 155, "CompiledGoFiles": 1846, "Modules": 42 }, "WorkspacePackages": { "Packages": 16, "LargestPackage": 12, "CompiledGoFiles": 41, "Modules": 1 }, "Diagnostics": 1 } ] } }

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.

<OPTIONAL: ATTACH LOGS HERE>

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.goplsIssues related to the Go language server, gopls.gopls/parsingIssues related to parsing / poor parser recovery.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions