Merge pull request #4820 from florianl/flo-preallocate

preallocate memory
This commit is contained in:
Kubernetes Prow Robot
2022-10-21 14:35:57 -07:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ func (s String) Len() int {
}
func (s String) List() []string {
var val []string
val := make([]string, 0, len(s))
for k := range s {
val = append(val, k)
}

View File

@@ -68,7 +68,7 @@ func (y *YFilter) UnmarshalYAML(unmarshal func(interface{}) error) error {
type YFilters []YFilter
func (y YFilters) Filters() []Filter {
var f []Filter
f := make([]Filter, 0, len(y))
for i := range y {
f = append(f, y[i].Filter)
}