Commit 35a34526 authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #28471 from smarterclayton/reflect_diff

Automatic merge from submit-queue Handle more cases in diff.ObjectReflectDiff Interfaces and nested map values were not being recursed. @karkagis since @wojtek-t is out
parents cd7a56ba b765203a
...@@ -145,7 +145,7 @@ func objectReflectDiff(path *field.Path, a, b reflect.Value) []diff { ...@@ -145,7 +145,7 @@ func objectReflectDiff(path *field.Path, a, b reflect.Value) []diff {
} }
} }
return changes return changes
case reflect.Ptr: case reflect.Ptr, reflect.Interface:
if a.IsNil() || b.IsNil() { if a.IsNil() || b.IsNil() {
switch { switch {
case a.IsNil() && b.IsNil(): case a.IsNil() && b.IsNil():
...@@ -199,7 +199,7 @@ func objectReflectDiff(path *field.Path, a, b reflect.Value) []diff { ...@@ -199,7 +199,7 @@ func objectReflectDiff(path *field.Path, a, b reflect.Value) []diff {
if reflect.DeepEqual(a.MapIndex(key).Interface(), b.MapIndex(key).Interface()) { if reflect.DeepEqual(a.MapIndex(key).Interface(), b.MapIndex(key).Interface()) {
continue continue
} }
missing = append(missing, diff{path: path.Key(fmt.Sprintf("%s", key.Interface())), a: a.MapIndex(key).Interface(), b: b.MapIndex(key).Interface()}) missing = append(missing, objectReflectDiff(path.Key(fmt.Sprintf("%s", key.Interface())), a.MapIndex(key), b.MapIndex(key))...)
continue continue
} }
missing = append(missing, diff{path: path.Key(fmt.Sprintf("%s", key.Interface())), a: nil, b: b.MapIndex(key).Interface()}) missing = append(missing, diff{path: path.Key(fmt.Sprintf("%s", key.Interface())), a: nil, b: b.MapIndex(key).Interface()})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment