mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/build/constraint: use strings.Builder instead of for { str+=str }
(This works around a bug in the stringsbuilder modernizer.) For #76476 Change-Id: I1cb8715fd79c0363cb9c159686eaeb3482c93228 Reviewed-on: https://go-review.googlesource.com/c/go/+/724721 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Bypass: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
0f6397384b
commit
0c747b7aa7
1 changed files with 6 additions and 6 deletions
|
|
@ -515,18 +515,18 @@ func PlusBuildLines(x Expr) ([]string, error) {
|
|||
// Prepare the +build lines.
|
||||
var lines []string
|
||||
for _, or := range split {
|
||||
line := "// +build"
|
||||
var line strings.Builder
|
||||
line.WriteString("// +build")
|
||||
for _, and := range or {
|
||||
clause := ""
|
||||
line.WriteString(" ")
|
||||
for i, lit := range and {
|
||||
if i > 0 {
|
||||
clause += ","
|
||||
line.WriteString(",")
|
||||
}
|
||||
clause += lit.String()
|
||||
line.WriteString(lit.String())
|
||||
}
|
||||
line += " " + clause
|
||||
}
|
||||
lines = append(lines, line)
|
||||
lines = append(lines, line.String())
|
||||
}
|
||||
|
||||
return lines, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue