mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
pkg/runtime: preallocate slice in unstructured.go
To avoid slice growth when appending.
This commit is contained in:
parent
1cca499e92
commit
c3fc714ec2
@ -59,7 +59,7 @@ func (unstructuredJSONScheme) EncodeToStream(obj Object, w io.Writer, overrides
|
||||
case *Unstructured:
|
||||
return json.NewEncoder(w).Encode(t.Object)
|
||||
case *UnstructuredList:
|
||||
var items []map[string]interface{}
|
||||
items := make([]map[string]interface{}, 0, len(t.Items))
|
||||
for _, i := range t.Items {
|
||||
items = append(items, i.Object)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user