[oscar] all: go fix -stringsbuilder ./...

1 view
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Feb 26, 2026, 10:07:56 PM (20 hours ago) Feb 26
to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, golang-co...@googlegroups.com

Hyang-Ah Hana Kim has uploaded the change for review

Commit message

all: go fix -stringsbuilder ./...
Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4

Change diff

diff --git a/internal/gcp/checks/checker.go b/internal/gcp/checks/checker.go
index 1ba8d87..884a299 100644
--- a/internal/gcp/checks/checker.go
+++ b/internal/gcp/checks/checker.go
@@ -10,6 +10,7 @@
"context"
"log/slog"
"net/http"
+ "strings"

"golang.org/x/oauth2"
oauth2google "golang.org/x/oauth2/google"
@@ -137,11 +138,11 @@
// the given text and optional promptParts. If the text represents an input to an LLM,
// promptParts should be empty.
func (c *Checker) newClassifyRequest(text string, promptParts []llm.Part) *ClassifyContentRequest {
- var prompt string
+ var prompt strings.Builder
for _, p := range promptParts {
switch p := p.(type) {
case llm.Text:
- prompt += string(p)
+ prompt.WriteString(string(p))
default:
// Not fatal; the prompt is only used for additional context.
c.lg.Info("checks.Checker: prompt type not supported", "part", p)
@@ -149,7 +150,7 @@
}
return &ClassifyContentRequest{
Context: &RequestContext{
- Prompt: prompt,
+ Prompt: prompt.String(),
},
Input: &InputContent{
TextInput: &TextInput{
diff --git a/internal/htmlutil/split.go b/internal/htmlutil/split.go
index 9cd2dd9..17c00b0 100644
--- a/internal/htmlutil/split.go
+++ b/internal/htmlutil/split.go
@@ -71,17 +71,18 @@
flush := func(level int, id string) bool {
if level > 1 {
// Construct a title that gives the sequence of heading titles (h1 title > h2 title > ...).
- title := titles[0]
+ var title strings.Builder
+ title.WriteString(titles[0])
for _, s := range titles[1:] {
if s != "" {
- title += " > " + s
+ title.WriteString(" > " + s)
}
}

// Emit the section.
txt := strings.TrimSpace(text.String())
if txt != "" && lastID != "" {
- if !yield(&Section{Title: title, ID: lastID, Text: txt}) {
+ if !yield(&Section{Title: title.String(), ID: lastID, Text: txt}) {
return false
}
}

Change information

Files:
  • M internal/gcp/checks/checker.go
  • M internal/htmlutil/split.go
Change size: S
Delta: 2 files changed, 8 insertions(+), 6 deletions(-)
Open in Gerrit

Related details

Attention set is empty
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: newchange
Gerrit-Project: oscar
Gerrit-Branch: master
Gerrit-Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
Gerrit-Change-Number: 749649
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
4:20 PM (2 hours ago) 4:20 PM
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Ian Lance Taylor voted and added 1 comment

Votes added by Ian Lance Taylor

Code-Review+2

1 comment

File internal/htmlutil/split.go
Line 78, Patchset 1 (Latest): title.WriteString(" > " + s)
Ian Lance Taylor . resolved

This is silly. It should be

    title.WriteString(" > ")
title.WriteString(s)

The analyzer may have been fixed for #77369.

Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement 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: oscar
Gerrit-Branch: master
Gerrit-Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
Gerrit-Change-Number: 749649
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Fri, 27 Feb 2026 21:20:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Nicholas Husin (Gerrit)

unread,
4:40 PM (2 hours ago) 4:40 PM
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Nicholas Husin voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement 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: oscar
    Gerrit-Branch: master
    Gerrit-Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
    Gerrit-Change-Number: 749649
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 21:40:06 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Cherry Mui (Gerrit)

    unread,
    4:40 PM (2 hours ago) 4:40 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Nicholas Husin, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Hyang-Ah Hana Kim

    Cherry Mui voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hyang-Ah Hana Kim
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement 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: oscar
    Gerrit-Branch: master
    Gerrit-Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
    Gerrit-Change-Number: 749649
    Gerrit-PatchSet: 1
    Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Cherry Mui <cher...@google.com>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Comment-Date: Fri, 27 Feb 2026 21:40:20 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Hyang-Ah Hana Kim (Gerrit)

    unread,
    4:44 PM (2 hours ago) 4:44 PM
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Nicholas Husin, Ian Lance Taylor, Go LUCI, golang-co...@googlegroups.com

    Hyang-Ah Hana Kim submitted the change

    Change information

    Commit message:
    all: go fix -stringsbuilder ./...
    Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
    Reviewed-by: Cherry Mui <cher...@google.com>
    Reviewed-by: Nicholas Husin <hu...@google.com>
    Reviewed-by: Ian Lance Taylor <ia...@golang.org>
    Files:
    • M internal/gcp/checks/checker.go
    • M internal/htmlutil/split.go
    Change size: S
    Delta: 2 files changed, 8 insertions(+), 6 deletions(-)
    Branch: refs/heads/master
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Cherry Mui, +1 by Nicholas Husin, +2 by Ian Lance Taylor
    • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: oscar
    Gerrit-Branch: master
    Gerrit-Change-Id: I40b398cb4db107d4dd563aa5f7898667e2458ae4
    Gerrit-Change-Number: 749649
    Gerrit-PatchSet: 2
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages