kyaml/yaml: preallocate memory

Signed-off-by: Florian Lehner <dev@der-flo.net>
This commit is contained in:
Florian Lehner
2022-10-06 05:38:18 +02:00
parent 0fbaa2d0e8
commit c2312c4018

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)
}