Save 2-3 commits from unstructured object creation.

pull/564/head
Clayton Coleman 2019-02-12 16:32:58 -05:00
parent d0daa1082f
commit 07868a5828
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3
1 changed files with 1 additions and 1 deletions

View File

@ -746,7 +746,7 @@ func isZero(v reflect.Value) bool {
func structToUnstructured(sv, dv reflect.Value) error {
st, dt := sv.Type(), dv.Type()
if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 {
dv.Set(reflect.MakeMap(mapStringInterfaceType))
dv.Set(reflect.MakeMapWithSize(mapStringInterfaceType, st.NumField()))
dv = dv.Elem()
dt = dv.Type()
}