pkg/kubectl: preallocate slice

To avoid slice growth with append operations.
This commit is contained in:
Gyu-Ho Lee
2016-05-29 02:09:39 -07:00
parent 825cd920ff
commit a14a288c3f
5 changed files with 21 additions and 20 deletions

View File

@@ -101,7 +101,7 @@ func PrintRolloutHistory(historyInfo HistoryInfo, resource, name string) (string
return fmt.Sprintf("No rollout history found in %s %q", resource, name), nil
}
// Sort the revisionToChangeCause map by revision
var revisions []int64
revisions := make([]int64, 0, len(historyInfo.RevisionToTemplate))
for r := range historyInfo.RevisionToTemplate {
revisions = append(revisions, r)
}