#!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

Comment From: adonovan

The fix may be as simple as a return statement. Whatever it is, let's cherrypick it into rc3.

Comment From: adonovan

This stack nSR9Wg was reported by telemetry:

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

This stack x4Uhuw was reported by telemetry:

golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.2 linux/amd64 vscode (5)
golang.org/x/tools/gopls@v0.19.0-pre.2 go1.24.3 linux/amd64 other,vscode (37)

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: gopherbot

Change https://go.dev/cl/680258 mentions this issue: gopls/internal/cache: add missing error check