[tools] gopls/internal/test: address out of bounds panic in BenchmarkSemanticTokens

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jun 29, 2026, 3:23:07 PM (2 days ago) Jun 29
to Madeline Kalil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Alan Donovan, Alex Putman, golang-co...@googlegroups.com

Gopher Robot submitted the change with unreviewed changes

Unreviewed changes

1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: gopls/internal/test/integration/fake/editor.go
Insertions: 1, Deletions: 1.

@@ -1856,7 +1856,7 @@
text := string(m.Content[start:end])

if t >= uint32(len(legend.TokenTypes)) {
- return nil, fmt.Errorf("index %d is out of bounds for SemanticTokensLegend with length %d", t, len(legend.TokenTypes))
+ return nil, fmt.Errorf("tokenType index %d is out of bounds for SemanticTokensLegend.TokenTypes with length %d", t, len(legend.TokenTypes))
}

ans = append(ans, SemanticToken{
```

Change information

Commit message:
gopls/internal/test: address out of bounds panic in BenchmarkSemanticTokens

We are currently not generating any performance metrics for gopls
because the benchmarks suite panics in BenchmarkSemanticTokens.

See go.dev/cl/794620 for more details.

Report an error instead of panicing when the index is out of
bounds for TokenTypes. (I still don't understand why we hit
this scenario).

For golang/go#80113
Change-Id: Iba0eb06bcc439283a4f8924806fbc828aed0f6a3
Reviewed-by: Alan Donovan <adon...@google.com>
Auto-Submit: Madeline Kalil <mka...@google.com>
Reviewed-by: Alex Putman <apu...@golang.org>
Files:
  • M gopls/internal/test/integration/fake/editor.go
Change size: XS
Delta: 1 file changed, 4 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: Iba0eb06bcc439283a4f8924806fbc828aed0f6a3
Gerrit-Change-Number: 795320
Gerrit-PatchSet: 3
Gerrit-Owner: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages