Skip to content

Commit 4b395c5

Browse files
authored
Merge pull request cli#2234 from XD-DENG/stringsbuilder
Use strings.Builder for more efficient string concatenation
2 parents 7512d91 + 7e9f1c7 commit 4b395c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cmd/pr/create/create.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@ func computeDefaults(baseRef, headRef string) (shared.Defaults, error) {
502502
} else {
503503
out.Title = utils.Humanize(headRef)
504504

505-
body := ""
505+
var body strings.Builder
506506
for i := len(commits) - 1; i >= 0; i-- {
507-
body += fmt.Sprintf("- %s\n", commits[i].Title)
507+
fmt.Fprintf(&body, "- %s\n", commits[i].Title)
508508
}
509-
out.Body = body
509+
out.Body = body.String()
510510
}
511511

512512
return out, nil

0 commit comments

Comments
 (0)