Skip to content

x/tools/gopls/internal/cache: nil deref in modindex.Index.Lookup #74055

Closed
@adonovan

Description

@adonovan
#!stacks
"sigpanic" && "modindex.(*Index).Lookup" && "cache.(*goplsSource).resolveCacheReferences"

Issue created by stacks.

func (s *goplsSource) resolveCacheReferences(missing imports.References) ([]*result, error) {
	ix, err := s.S.view.ModcacheIndex()
	if err != nil {
		event.Error(s.ctx, "resolveCacheReferences", err)  <----------- missing return
	}

	found := make(map[string]*result)
	for pkg, nms := range missing {
		var ks []string
		for k := range nms {
			ks = append(ks, k)
		}
		cs := ix.LookupAll(pkg, ks...) // map[importPath][]Candidate        <-------- panics within here

This stack sKaGhw was reported by telemetry:

golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 darwin/arm64 other,vscode (1)

Dups: nSR9Wg x4Uhuw oAH9Ug 6exHug SO76sQ b_Sm8g MWR90Q MigjvA gwPnLQ iArnDA

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

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions