Skip to content

Commit 0beced9

Browse files
committed
Re-added pre-allocation.
1 parent 1a204a2 commit 0beced9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

models/repo/license.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ type RepoLicense struct { //revive:disable-line:exported
2727
type RepoLicenseList []*RepoLicense //revive:disable-line:exported
2828

2929
func (rll RepoLicenseList) StringList() []string {
30-
var licenses []string
30+
if len(rll) == 0 {
31+
return nil
32+
}
33+
licenses := make([]string, 0, len(rll))
3134
for _, rl := range rll {
3235
licenses = append(licenses, rl.License)
3336
}

0 commit comments

Comments
 (0)