Use strings.Builder for more efficient string concatenation
It minimizes memory copying. Reference: https://golang.org/pkg/strings/#Builder
This commit is contained in:
parent
f1ea9102c4
commit
7e9f1c7147
1 changed files with 3 additions and 3 deletions
|
|
@ -501,11 +501,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue