Merge pull request #2234 from XD-DENG/stringsbuilder

Use strings.Builder for more efficient string concatenation
This commit is contained in:
Mislav Marohnić 2020-10-21 18:22:43 +02:00 committed by GitHub
commit 4b395c5dd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -502,11 +502,11 @@ func computeDefaults(baseRef, headRef string) (shared.Defaults, error) {
} else {
out.Title = utils.Humanize(headRef)
body := ""
var body strings.Builder
for i := len(commits) - 1; i >= 0; i-- {
body += fmt.Sprintf("- %s\n", commits[i].Title)
fmt.Fprintf(&body, "- %s\n", commits[i].Title)
}
out.Body = body
out.Body = body.String()
}
return out, nil