Skip to content

x/tools/gopls: "missing reference to package %s" bug in getOneTransitiveRefLocked #71354

@adonovan

Description

@adonovan
#!stacks
"bug.Reportf" && "getOneTransitiveRefLocked:+32"

Issue created by stacks.

	// Note that if (!ok && trefs.complete), the name does not exist in the
	// referenced package, and we should not write to trefs as that may introduce
	// a race.
	if !ok && !trefs.complete {
		n := b.nodes[sym.Package]
		if n == nil {
			// We should always have IndexID in our node set, because symbol references
			// should only be recorded for packages that actually exist in the import graph.
			//
			// However, it is not easy to prove this (typerefs are serialized and
			// deserialized), so make this code temporarily defensive while we are on a
			// point release.
			//
			// TODO(rfindley): in the future, we should turn this into an assertion.
			bug.Reportf("missing reference to package %s", b.s.view.pkgIndex.PackageID(sym.Package)) <---- here
			return nil
		}

This stack vcyB-g was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.2 linux/amd64 vscode (2)

Activity

added
goplsIssues related to the Go language server, gopls.
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.
on Jan 20, 2025
added this to the Unreleased milestone on Jan 20, 2025
added
BugReportIssues describing a possible bug in the Go implementation.
on Jan 20, 2025
self-assigned this
on Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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

Development

No branches or pull requests

    Participants

    @adonovan@gopherbot@findleyr@gabyhelp

    Issue actions

      x/tools/gopls: "missing reference to package %s" bug in getOneTransitiveRefLocked · Issue #71354 · golang/go