Convert disk booleans from wwbool to *bool
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
cc946e0b99
commit
59f187bf5e
@@ -187,12 +187,16 @@ func recursiveFlatten(obj interface{}) (hasContent bool) {
|
||||
|
||||
case reflect.Ptr:
|
||||
if valObj.Elem().Field(i).Addr().IsValid() {
|
||||
ret := recursiveFlatten((valObj.Elem().Field(i).Interface()))
|
||||
if !ret {
|
||||
valObj.Elem().Field(i).Set(reflect.Zero(valObj.Elem().Field(i).Type()))
|
||||
// Handle *bool fields separately as they are not structs
|
||||
if typeObj.Elem().Field(i).Type == reflect.TypeOf((*bool)(nil)) {
|
||||
hasContent = !valObj.Elem().Field(i).IsZero() || hasContent
|
||||
} else {
|
||||
ret := recursiveFlatten((valObj.Elem().Field(i).Interface()))
|
||||
if !ret {
|
||||
valObj.Elem().Field(i).Set(reflect.Zero(valObj.Elem().Field(i).Type()))
|
||||
}
|
||||
hasContent = ret || hasContent
|
||||
}
|
||||
hasContent = ret || hasContent
|
||||
|
||||
}
|
||||
case reflect.Struct:
|
||||
ret := recursiveFlatten((valObj.Elem().Field(i).Addr().Interface()))
|
||||
|
||||
Reference in New Issue
Block a user