[tools] gopls/internal/filecache: add GetDecoded for caching decoded objects

3 views
Skip to first unread message

Robert Findley (Gerrit)

unread,
Apr 7, 2026, 3:38:47 PM (2 days ago) Apr 7
to goph...@pubsubhelper.golang.org, Alan Donovan, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Robert Findley voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
Gerrit-Change-Number: 763240
Gerrit-PatchSet: 7
Gerrit-Owner: Robert Findley <rfin...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Tue, 07 Apr 2026 19:38:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Apr 7, 2026, 8:33:07 PM (2 days ago) Apr 7
to Robert Findley, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Robert Findley

Alan Donovan added 12 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Alan Donovan . resolved

Very nice!

File gopls/internal/cache/analysis.go
Line 586, Patchset 8 (Latest): if s, err := filecache.Get(cacheKind, key, func(data []byte) *analyzeSummary {
var s *analyzeSummary
analyzeSummaryCodec.Decode(data, &s)
return s
}); err == nil {
Alan Donovan . unresolved

This would make a nice toplevel function adjacent to analyzeSummaryCodec.Decode.

Line 592, Patchset 8 (Latest): if s == nil { // debugging #66732
bug.Reportf("analyzeSummaryCodec.Decode yielded nil *analyzeSummary")
} else {
Alan Donovan . unresolved

This bug was fixed; let's delete this control flow path.

Line 595, Patchset 8 (Latest): // Copy: callers may zero out summary.Actions (see decrefPreds),
// so we must not mutate the shared cached value.
Alan Donovan . unresolved

Yikes that is subtle

XXX

File gopls/internal/cache/check.go
Line 309, Patchset 8 (Latest): data, err := filecache.Get(exportDataKind, ph.key, filecache.Bytes)
Alan Donovan . resolved

Oooh... this makes me wonder whether we could cache the pre-decoded export data in some meaningful way, independent of token.FileSet and types.Importer, that would make it cheaper to specialize it in as needed. Another day...

Line 1403, Patchset 8 (Latest): if data, err := filecache.Get(typerefsKind, key, filecache.Bytes); err == nil {
Alan Donovan . resolved

Sadly in this case the decoding depends on s.view.pkgIndex, so we can't usefully cache it.

File gopls/internal/cache/xrefs/xrefs.go
Line 135, Patchset 8 (Latest): return packageCodec.Encode(packages)
Alan Donovan . unresolved

I think you can simplify the API of this package if you split this function before this step. I constructs a JSON tree, then encodes it to binary. But if it were to return the tree, it could be cached directly, and the encode step could be moved to storePackageResults just like all the others.

File gopls/internal/filecache/filecache.go
Line 102, Patchset 8 (Latest): if data, ok = v.([]byte); !ok {
Alan Donovan . unresolved

I wonder why this case is necessary. Should the memCache always hold a value of type T?

Line 105, Patchset 8 (Latest): return zero, bug.Errorf("filecache: kind %q used with multiple decoded types (got %T, want %T)", kind, v, zero)
Alan Donovan . unresolved

We can just panic here; as you say, it's a programming error.

Line 119, Patchset 8 (Latest):// get reads the value for (kind, key) from disk, bypassing the
// in-memory cache.
Alan Donovan . unresolved

"the file system."

Line 627, Patchset 8 (Latest):func BugReports() (string, []bug.Bug) {
Alan Donovan . resolved

FWIW I plan to remove this mechanism, which was never really useful (unlike crash telemetry, which has been so effective that now most new reports are due to hardware faults).

File gopls/internal/filewatcher/poll_watcher.go
Line 351, Patchset 8 (Latest): data, err := filecache.Get(filewatcherKind, key, filecache.Bytes)
Alan Donovan . unresolved

Pass a lambda that calls codec.Decode?

Open in Gerrit

Related details

Attention is currently required from:
  • Robert Findley
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
    Gerrit-Change-Number: 763240
    Gerrit-PatchSet: 8
    Gerrit-Owner: Robert Findley <rfin...@golang.org>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Robert Findley <rfin...@golang.org>
    Gerrit-Comment-Date: Wed, 08 Apr 2026 00:33:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Robert Findley (Gerrit)

    unread,
    Apr 7, 2026, 8:42:34 PM (2 days ago) Apr 7
    to goph...@pubsubhelper.golang.org, Go LUCI, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alan Donovan

    Robert Findley added 2 comments

    File gopls/internal/cache/analysis.go
    Line 595, Patchset 8 (Latest): // Copy: callers may zero out summary.Actions (see decrefPreds),
    // so we must not mutate the shared cached value.
    Alan Donovan . unresolved

    Yikes that is subtle

    XXX

    Robert Findley

    Agreed. I think let's just revert this one to bytes and do the decoding in line. Too subtle.

    File gopls/internal/filecache/filecache.go
    Line 102, Patchset 8 (Latest): if data, ok = v.([]byte); !ok {
    Alan Donovan . unresolved

    I wonder why this case is necessary. Should the memCache always hold a value of type T?

    Robert Findley

    We don't Set the value: we still Set the bytes and only replace with the decoded value on the first Get. I thought about making the API symmetric and passing in bytes to Set, but actually don't want to have any sort of dependency on pointer identities.

    WDYT?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alan Donovan
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
    Gerrit-Change-Number: 763240
    Gerrit-PatchSet: 8
    Gerrit-Owner: Robert Findley <rfin...@golang.org>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Alan Donovan <adon...@google.com>
    Gerrit-Comment-Date: Wed, 08 Apr 2026 00:42:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Alan Donovan <adon...@google.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Alan Donovan (Gerrit)

    unread,
    Apr 7, 2026, 8:46:54 PM (2 days ago) Apr 7
    to Robert Findley, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Robert Findley

    Alan Donovan added 3 comments

    File gopls/internal/cache/analysis.go
    Line 595, Patchset 8 (Latest): // Copy: callers may zero out summary.Actions (see decrefPreds),
    // so we must not mutate the shared cached value.
    Alan Donovan . unresolved

    Yikes that is subtle

    XXX

    Alan Donovan

    Sorry, I meant to write that better before I mailed it out!

    File gopls/internal/filecache/filecache.go
    Line 78, Patchset 8 (Latest):// and upgraded in place.
    Alan Donovan . unresolved

    "from raw bytes to decoded data"?

    Line 102, Patchset 8 (Latest): if data, ok = v.([]byte); !ok {
    Alan Donovan . unresolved

    I wonder why this case is necessary. Should the memCache always hold a value of type T?

    Robert Findley

    We don't Set the value: we still Set the bytes and only replace with the decoded value on the first Get. I thought about making the API symmetric and passing in bytes to Set, but actually don't want to have any sort of dependency on pointer identities.

    WDYT?

    Alan Donovan

    I thought about making the API symmetric and passing in bytes to Set, but actually don't want to have any sort of dependency on pointer identities.

    I assume you mean passing an encoder to Set. But yes that makes sense. A comment would help (see above).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Robert Findley
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
    Gerrit-Change-Number: 763240
    Gerrit-PatchSet: 8
    Gerrit-Owner: Robert Findley <rfin...@golang.org>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Robert Findley <rfin...@golang.org>
    Gerrit-Comment-Date: Wed, 08 Apr 2026 00:46:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Alan Donovan <adon...@google.com>
    Comment-In-Reply-To: Robert Findley <rfin...@golang.org>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Robert Findley (Gerrit)

    unread,
    Apr 8, 2026, 10:39:30 AM (14 hours ago) Apr 8
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Robert Findley

    Robert Findley uploaded new patchset

    Robert Findley uploaded patch set #9 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Robert Findley
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
      Gerrit-Change-Number: 763240
      Gerrit-PatchSet: 9
      unsatisfied_requirement
      open
      diffy

      Robert Findley (Gerrit)

      unread,
      Apr 8, 2026, 10:44:25 AM (14 hours ago) Apr 8
      to goph...@pubsubhelper.golang.org, Go LUCI, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Alan Donovan

      Robert Findley added 8 comments

      File gopls/internal/cache/analysis.go
      Line 586, Patchset 8: if s, err := filecache.Get(cacheKind, key, func(data []byte) *analyzeSummary {

      var s *analyzeSummary
      analyzeSummaryCodec.Decode(data, &s)
      return s
      }); err == nil {
      Alan Donovan . resolved

      This would make a nice toplevel function adjacent to analyzeSummaryCodec.Decode.

      Robert Findley

      Ack -- obsolete since I backed off of caching the summary. Maybe for a later PR where we can make it obviously immutable.

      Line 592, Patchset 8: if s == nil { // debugging #66732

      bug.Reportf("analyzeSummaryCodec.Decode yielded nil *analyzeSummary")
      } else {
      Alan Donovan . resolved

      This bug was fixed; let's delete this control flow path.

      Robert Findley

      Ok, I've cleaned up all the artifacts of this bug (looks like it was never root caused, but I see that it was closed).

      Line 595, Patchset 8: // Copy: callers may zero out summary.Actions (see decrefPreds),

      // so we must not mutate the shared cached value.
      Alan Donovan . resolved

      Yikes that is subtle

      XXX

      Alan Donovan

      Sorry, I meant to write that better before I mailed it out!

      Robert Findley

      Yeah, I'll follow up with a CL clarifying the immutable part of the summary. That's enough to be its own CL.

      File gopls/internal/cache/xrefs/xrefs.go
      Line 135, Patchset 8: return packageCodec.Encode(packages)
      Alan Donovan . resolved

      I think you can simplify the API of this package if you split this function before this step. I constructs a JSON tree, then encodes it to binary. But if it were to return the tree, it could be cached directly, and the encode step could be moved to storePackageResults just like all the others.

      Robert Findley

      Done

      File gopls/internal/filecache/filecache.go
      Line 105, Patchset 8: return zero, bug.Errorf("filecache: kind %q used with multiple decoded types (got %T, want %T)", kind, v, zero)
      Alan Donovan . resolved

      We can just panic here; as you say, it's a programming error.

      Robert Findley

      Done

      Line 119, Patchset 8:// get reads the value for (kind, key) from disk, bypassing the
      // in-memory cache.
      Alan Donovan . resolved

      "the file system."

      Robert Findley

      Done

      Line 627, Patchset 8:func BugReports() (string, []bug.Bug) {
      Alan Donovan . resolved

      FWIW I plan to remove this mechanism, which was never really useful (unlike crash telemetry, which has been so effective that now most new reports are due to hardware faults).

      Robert Findley

      Sounds good.

      File gopls/internal/filewatcher/poll_watcher.go
      Line 351, Patchset 8: data, err := filecache.Get(filewatcherKind, key, filecache.Bytes)
      Alan Donovan . resolved

      Pass a lambda that calls codec.Decode?

      Robert Findley

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alan Donovan
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
      Gerrit-Change-Number: 763240
      Gerrit-PatchSet: 9
      Gerrit-Owner: Robert Findley <rfin...@golang.org>
      Gerrit-Reviewer: Alan Donovan <adon...@google.com>
      Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Alan Donovan <adon...@google.com>
      Gerrit-Comment-Date: Wed, 08 Apr 2026 14:44:21 +0000
      unsatisfied_requirement
      open
      diffy

      Robert Findley (Gerrit)

      unread,
      Apr 8, 2026, 10:57:16 AM (14 hours ago) Apr 8
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Alan Donovan

      Robert Findley uploaded new patchset

      Robert Findley uploaded patch set #10 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alan Donovan
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: tools
      Gerrit-Branch: master
      Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
      Gerrit-Change-Number: 763240
      Gerrit-PatchSet: 10
      unsatisfied_requirement
      open
      diffy

      Robert Findley (Gerrit)

      unread,
      Apr 8, 2026, 10:57:42 AM (14 hours ago) Apr 8
      to goph...@pubsubhelper.golang.org, Go LUCI, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Alan Donovan

      Robert Findley voted and added 2 comments

      Votes added by Robert Findley

      Commit-Queue+1

      2 comments

      File gopls/internal/filecache/filecache.go
      Line 78, Patchset 8:// and upgraded in place.
      Alan Donovan . resolved

      "from raw bytes to decoded data"?

      Robert Findley

      Done

      Line 102, Patchset 8: if data, ok = v.([]byte); !ok {
      Alan Donovan . resolved

      I wonder why this case is necessary. Should the memCache always hold a value of type T?

      Robert Findley

      We don't Set the value: we still Set the bytes and only replace with the decoded value on the first Get. I thought about making the API symmetric and passing in bytes to Set, but actually don't want to have any sort of dependency on pointer identities.

      WDYT?

      Alan Donovan

      I thought about making the API symmetric and passing in bytes to Set, but actually don't want to have any sort of dependency on pointer identities.

      I assume you mean passing an encoder to Set. But yes that makes sense. A comment would help (see above).

      Robert Findley

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alan Donovan
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: tools
        Gerrit-Branch: master
        Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
        Gerrit-Change-Number: 763240
        Gerrit-PatchSet: 10
        Gerrit-Owner: Robert Findley <rfin...@golang.org>
        Gerrit-Reviewer: Alan Donovan <adon...@google.com>
        Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Alan Donovan <adon...@google.com>
        Gerrit-Comment-Date: Wed, 08 Apr 2026 14:57:38 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Alan Donovan (Gerrit)

        unread,
        Apr 8, 2026, 11:07:37 AM (13 hours ago) Apr 8
        to Robert Findley, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Robert Findley

        Alan Donovan added 3 comments

        File gopls/internal/cache/xrefs/xrefs.go
        Line 26, Patchset 9:func Index(files []*parsego.File, pkg *types.Package, info *types.Info) *XrefIndex {
        Alan Donovan . unresolved

        Let's call this `func NewIndex(...) *Index`.

        File gopls/internal/filewatcher/poll_watcher.go
        Line 351, Patchset 9: state, err := filecache.Get(filewatcherKind, key, func(data []byte) fileState {
        var state fileState
        codec.Decode(data, &state)
        return state
        })
        Alan Donovan . unresolved

        BTW, this could be just codec.Decode2 if you add this method in frob:

        ```
        func (codec Codec[T]) Decode2(data []byte) (x T) {
        codec.Decode(data, &x)
        return
        }
        ```

        The analysis.go one (now deleted) has a similar form.

        Obviously it needs a better name. Perhaps Decode, Decode2 -> DecodeTo, Decode?

        Line 356, Patchset 9: if err != nil && err != filecache.ErrNotFound {
        Alan Donovan . resolved

        FYI: EMFILES and ENFILES are common errors from this operation when file descriptors are exhausted (which can happen either due to `go list`'s DiskCache.Trim, or when using gopls' inotify-based watcher.)

        I plan to abstract some kind of filecache.IsTransientError(err) function so that all the callers of Get don't have to reinvent the error-filtering wheel.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Robert Findley
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: tools
          Gerrit-Branch: master
          Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
          Gerrit-Change-Number: 763240
          Gerrit-PatchSet: 9
          Gerrit-Owner: Robert Findley <rfin...@golang.org>
          Gerrit-Reviewer: Alan Donovan <adon...@google.com>
          Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-Attention: Robert Findley <rfin...@golang.org>
          Gerrit-Comment-Date: Wed, 08 Apr 2026 15:07:32 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          unsatisfied_requirement
          open
          diffy

          Robert Findley (Gerrit)

          unread,
          Apr 8, 2026, 2:22:10 PM (10 hours ago) Apr 8
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Robert Findley

          Robert Findley uploaded new patchset

          Robert Findley uploaded patch set #11 to this change.
          Following approvals got outdated and were removed:
          • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Robert Findley
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: tools
          Gerrit-Branch: master
          Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
          Gerrit-Change-Number: 763240
          Gerrit-PatchSet: 11
          unsatisfied_requirement
          open
          diffy

          Robert Findley (Gerrit)

          unread,
          Apr 8, 2026, 2:23:16 PM (10 hours ago) Apr 8
          to goph...@pubsubhelper.golang.org, Go LUCI, Alan Donovan, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Alan Donovan

          Robert Findley added 3 comments

          File gopls/internal/cache/xrefs/xrefs.go
          Line 26, Patchset 9:func Index(files []*parsego.File, pkg *types.Package, info *types.Info) *XrefIndex {
          Alan Donovan . resolved

          Let's call this `func NewIndex(...) *Index`.

          Robert Findley

          Done. Nice.

          File gopls/internal/filewatcher/poll_watcher.go
          Line 351, Patchset 9: state, err := filecache.Get(filewatcherKind, key, func(data []byte) fileState {
          var state fileState
          codec.Decode(data, &state)
          return state
          })
          Alan Donovan . resolved

          BTW, this could be just codec.Decode2 if you add this method in frob:

          ```
          func (codec Codec[T]) Decode2(data []byte) (x T) {
          codec.Decode(data, &x)
          return
          }
          ```

          The analysis.go one (now deleted) has a similar form.

          Obviously it needs a better name. Perhaps Decode, Decode2 -> DecodeTo, Decode?

          Robert Findley

          Let's do this in a separate CL. I'll send a follow-up.

          Line 356, Patchset 9: if err != nil && err != filecache.ErrNotFound {
          Alan Donovan . resolved

          FYI: EMFILES and ENFILES are common errors from this operation when file descriptors are exhausted (which can happen either due to `go list`'s DiskCache.Trim, or when using gopls' inotify-based watcher.)

          I plan to abstract some kind of filecache.IsTransientError(err) function so that all the callers of Get don't have to reinvent the error-filtering wheel.

          Robert Findley

          Ack, sounds good.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Alan Donovan
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
            Gerrit-Change-Number: 763240
            Gerrit-PatchSet: 11
            Gerrit-Owner: Robert Findley <rfin...@golang.org>
            Gerrit-Reviewer: Alan Donovan <adon...@google.com>
            Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Attention: Alan Donovan <adon...@google.com>
            Gerrit-Comment-Date: Wed, 08 Apr 2026 18:23:13 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Alan Donovan <adon...@google.com>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Alan Donovan (Gerrit)

            unread,
            Apr 8, 2026, 2:39:14 PM (10 hours ago) Apr 8
            to Robert Findley, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Robert Findley

            Alan Donovan voted and added 2 comments

            Votes added by Alan Donovan

            Code-Review+2

            2 comments

            File gopls/internal/cache/analysis.go
            Line 373, Patchset 11 (Parent): // Inv: all root nodes now have a summary (#66732).
            Alan Donovan . unresolved

            Now that the bug is fixed (we believe), can we restore this with a hard panic (and updated comment)? The invariant is still important.

            File gopls/internal/cache/xrefs/xrefs.go
            Line 138, Patchset 11 (Latest):// An Index is a decoded cross-reference index, ready for lookups.
            Alan Donovan . unresolved

            // An Index an index of outbound symbol references for one specific package.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Robert Findley
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
            Gerrit-Change-Number: 763240
            Gerrit-PatchSet: 11
            Gerrit-Owner: Robert Findley <rfin...@golang.org>
            Gerrit-Reviewer: Alan Donovan <adon...@google.com>
            Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Attention: Robert Findley <rfin...@golang.org>
            Gerrit-Comment-Date: Wed, 08 Apr 2026 18:39:11 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Robert Findley (Gerrit)

            unread,
            Apr 8, 2026, 5:47:32 PM (7 hours ago) Apr 8
            to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
            Attention needed from Robert Findley

            Robert Findley uploaded new patchset

            Robert Findley uploaded patch set #12 to this change.
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Robert Findley
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: newpatchset
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
            Gerrit-Change-Number: 763240
            Gerrit-PatchSet: 12
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Robert Findley (Gerrit)

            unread,
            Apr 8, 2026, 6:35:15 PM (6 hours ago) Apr 8
            to goph...@pubsubhelper.golang.org, Alan Donovan, Go LUCI, Gopher Robot, golang-co...@googlegroups.com

            Robert Findley added 2 comments

            File gopls/internal/cache/analysis.go
            Line 373, Patchset 11 (Parent): // Inv: all root nodes now have a summary (#66732).
            Alan Donovan . resolved

            Now that the bug is fixed (we believe), can we restore this with a hard panic (and updated comment)? The invariant is still important.

            Robert Findley

            Done

            File gopls/internal/cache/xrefs/xrefs.go
            Line 138, Patchset 11:// An Index is a decoded cross-reference index, ready for lookups.
            Alan Donovan . resolved

            // An Index an index of outbound symbol references for one specific package.

            Robert Findley

            Done

            Open in Gerrit

            Related details

            Attention set is empty
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
            Gerrit-Change-Number: 763240
            Gerrit-PatchSet: 12
            Gerrit-Owner: Robert Findley <rfin...@golang.org>
            Gerrit-Reviewer: Alan Donovan <adon...@google.com>
            Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Comment-Date: Wed, 08 Apr 2026 22:35:12 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Robert Findley (Gerrit)

            unread,
            Apr 8, 2026, 6:51:07 PM (6 hours ago) Apr 8
            to goph...@pubsubhelper.golang.org, Alan Donovan, Go LUCI, Gopher Robot, golang-co...@googlegroups.com

            Robert Findley voted Commit-Queue+1

            Commit-Queue+1
            Open in Gerrit

            Related details

            Attention set is empty
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement is not satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: tools
            Gerrit-Branch: master
            Gerrit-Change-Id: Ic6cf05669da822fd6dd3afa925e62c2da301c78a
            Gerrit-Change-Number: 763240
            Gerrit-PatchSet: 12
            Gerrit-Owner: Robert Findley <rfin...@golang.org>
            Gerrit-Reviewer: Alan Donovan <adon...@google.com>
            Gerrit-Reviewer: Robert Findley <rfin...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-Comment-Date: Wed, 08 Apr 2026 22:51:04 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages