Skip to content

x/tools/gopls: nil panic in types.Package.Path while writing export data (internal/gcimporter) #73854

Open
@adonovan

Description

@adonovan
#!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:

golang.org/x/tools/gopls@v0.18.1 go1.23.8 darwin/arm64 other,vscode (25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/telemetry-wins

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions