#!stacks
"go/types.(*Package).Path:=34" && "gcimporter.(*exportWriter).exportPath:=688"
Issue created by stacks.
If you walk all the way up the stack, you get to this line, which writes the value of a constant. It passes pkg=nil (meaning "the current package"), yet somehow the nil pkg is plumbed all the way down to exportPath, which assumes it is non-nil.
func (w *exportWriter) value(typ types.Type, v constant.Value) {
w.typ(typ, nil)
This stack 0BaS9w was reported by telemetry:
crash/crashruntime.gopanic:+69golang.org/x/tools/internal/gcimporter.iexportCommon.func1:+7runtime.gopanic:+50runtime.panicmem:=262runtime.sigpanic:+19go/types.(*Package).Path:=34golang.org/x/tools/internal/gcimporter.(*exportWriter).exportPath:=688golang.org/x/tools/internal/gcimporter.(*exportWriter).pkg:+4golang.org/x/tools/internal/gcimporter.(*exportWriter).doTyp:+119golang.org/x/tools/internal/gcimporter.(*iexporter).typOff:+4golang.org/x/tools/internal/gcimporter.(*exportWriter).typ:+1golang.org/x/tools/internal/gcimporter.(*exportWriter).typeList:+3golang.org/x/tools/internal/gcimporter.(*exportWriter).doTyp:+27golang.org/x/tools/internal/gcimporter.(*iexporter).typOff:+4golang.org/x/tools/internal/gcimporter.(*exportWriter).typ:+1golang.org/x/tools/internal/gcimporter.(*exportWriter).value:+1golang.org/x/tools/internal/gcimporter.(*iexporter).doDecl:+51golang.org/x/tools/internal/gcimporter.iexportCommon:+55golang.org/x/tools/internal/gcimporter.IExportShallow:+8
golang.org/x/tools/gopls@v0.18.1 go1.23.8 darwin/arm64 other,vscode (25)
Comment From: gabyhelp
Related Issues
- x/tools/gopls: crash exporting constant with partially defined type #60891 (closed)
- x/tools/gopls: SEGV in gcimporter.iexportCommon (bad SP) #72135
- x/tools/gopls: nil deref in Exporter.ProcessEvent #71928
- x/tools/gopls: Package.Path called on nil Package in AddTestForFunc #73687 (closed)
- x/tools/gopls: nil *types.Package panic in testKind #73096 (closed)
- runtime: SEGV in mapaccess2 (go1.23.2 darwin/amd64) #71123
- x/tools/gopls: "failed to find object for objectPath" bug in gcimporter #73588
- x/tools/gopls: nil deref panic in go.test code action #72907 (closed)
- x/tools/gopls: Rename: type assertion panics in renameImports #71656 (closed)
- x/tools/gopls: "package name is %q, want %q" bug in typeCheckBatch.importPackage #64235
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: adonovan
This stack ChWbnw was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.goPanicIndex:+2golang.org/x/tools/gopls/internal/golang.Definition:+107golang.org/x/tools/gopls/internal/server.(*server).Definition:+19golang.org/x/tools/gopls/internal/protocol.serverDispatch:+215golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.1 go1.24.2 darwin/arm64 vscode (1)
This stack wY83jw was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.panicmem:=262runtime.sigpanic:+19golang.org/x/tools/gopls/internal/cache.(*Snapshot).GoCommandInvocation:+5golang.org/x/tools/gopls/internal/server.(*commandHandler).Vendor.func1:+10golang.org/x/tools/gopls/internal/server.(*commandHandler).run.func2:+3golang.org/x/tools/gopls/internal/server.(*commandHandler).run:+81golang.org/x/tools/gopls/internal/server.(*commandHandler).Vendor:+1golang.org/x/tools/gopls/internal/protocol/command.Dispatch:+226golang.org/x/tools/gopls/internal/server.(*server).ExecuteCommand:+28golang.org/x/tools/gopls/internal/protocol.serverDispatch:+674golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.1 go1.24.0 darwin/arm64 neovim,vscode (5)
This stack v95MAw was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.panicmem:=262runtime.sigpanic:+19golang.org/x/tools/gopls/internal/golang.hover:+216golang.org/x/tools/gopls/internal/golang.Hover:+4golang.org/x/tools/gopls/internal/server.(*server).Hover:+30golang.org/x/tools/gopls/internal/protocol.serverDispatch:+335golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.1 go1.23.6 linux/amd64 vscode (1)
This stack 9iXGhQ was reported by telemetry:
crash/crashruntime.gopanic:+69golang.org/x/tools/refactor/satisfy.(*Finder).expr:+168golang.org/x/tools/refactor/satisfy.(*Finder).call:+26golang.org/x/tools/refactor/satisfy.(*Finder).exprN:+9golang.org/x/tools/refactor/satisfy.(*Finder).stmt:+35golang.org/x/tools/refactor/satisfy.(*Finder).stmt:+90golang.org/x/tools/refactor/satisfy.(*Finder).stmt:+204golang.org/x/tools/refactor/satisfy.(*Finder).stmt:+90golang.org/x/tools/refactor/satisfy.(*Finder).Find:+19golang.org/x/tools/gopls/internal/golang.(*renamer).satisfy:+27golang.org/x/tools/gopls/internal/golang.(*renamer).checkMethod:+178golang.org/x/tools/gopls/internal/golang.(*renamer).check:+16golang.org/x/tools/gopls/internal/golang.renameObjects:+24golang.org/x/tools/gopls/internal/golang.renameExported:+56golang.org/x/tools/gopls/internal/golang.renameOrdinary:+157golang.org/x/tools/gopls/internal/golang.Rename:+24
golang.org/x/tools/gopls@v0.18.1 go1.24.1 darwin/arm64 vscode (2)
This stack PrtfKQ was reported by telemetry:
crash/crashruntime.gopanic:+69go/types.(*Checker).handleBailout:+7go/types.(*Checker).Files.deferwrap1:+0runtime.gopanic:+50go/types.setDefType:+7go/types.(*Checker).typInternal:+175go/types.(*Checker).definedType:+1go/types.(*Checker).typeDecl:+55go/types.(*Checker).objDecl:+141go/types.(*Checker).packageObjects:+59go/types.(*Checker).checkFiles:+29go/types.(*Checker).Files:+13golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).checkPackage:+73golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).getPackage.func1:+49golang.org/x/tools/gopls/internal/cache.(*futureCache[...]).get:+32golang.org/x/tools/gopls/internal/cache.(*typeCheckBatch).getPackage:+1
golang.org/x/tools/gopls@v0.18.1 go1.23.6 windows/amd64 vscode (1)
golang.org/x/tools/gopls@v0.18.1 go1.23.6 linux/amd64 vscode (1)
This stack r1YMdg was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.panicmem:=262runtime.sigpanic:+9golang.org/x/tools/gopls/internal/golang.hover:+216golang.org/x/tools/gopls/internal/golang.Hover:+4golang.org/x/tools/gopls/internal/server.(*server).Hover:+30golang.org/x/tools/gopls/internal/protocol.serverDispatch:+335golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.1 go1.23.6 windows/amd64 vscode (1)
This stack Cys7zA was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.goPanicSliceAcap:+2golang.org/x/tools/gopls/internal/cache/parsego.fixInitStmt:+10golang.org/x/tools/gopls/internal/cache/parsego.fixAST.func1:+27golang.org/x/tools/gopls/internal/cache/parsego.walkASTWithParent.func1:+17go/ast.inspector.Visit:+1go/ast.Walk:+1go/ast.Walk:+224go/ast.walkList[...]:=21go/ast.Walk:+178go/ast.Walk:+299go/ast.walkList[...]:=21go/ast.Walk:+308go/ast.Inspect:=372golang.org/x/tools/gopls/internal/cache/parsego.walkASTWithParent:+2golang.org/x/tools/gopls/internal/cache/parsego.fixAST:+2golang.org/x/tools/gopls/internal/cache/parsego.Parse:+57golang.org/x/tools/gopls/internal/cache.(*parseCache).startParse.func1:+5golang.org/x/tools/internal/memoize.(*Promise).run.func2.1:+7
golang.org/x/tools/gopls@v0.18.1 go1.24.0 linux/amd64 neovim (1)