|
@@ -285,12 +285,16 @@ func recursiveUpdate(dst, src reflect.Value) error {
|
|
|
}
|
|
}
|
|
|
// If both dst and src are maps, handle them recursively
|
|
// If both dst and src are maps, handle them recursively
|
|
|
if dst.Kind() == reflect.Map && src.Kind() == reflect.Map {
|
|
if dst.Kind() == reflect.Map && src.Kind() == reflect.Map {
|
|
|
|
|
+ if dst.IsNil() {
|
|
|
|
|
+ dst.Set(reflect.MakeMap(dst.Type()))
|
|
|
|
|
+ }
|
|
|
for _, key := range src.MapKeys() {
|
|
for _, key := range src.MapKeys() {
|
|
|
srcVal := src.MapIndex(key)
|
|
srcVal := src.MapIndex(key)
|
|
|
// If the key doesn't exist in dst, initialize it
|
|
// If the key doesn't exist in dst, initialize it
|
|
|
dstVal := dst.MapIndex(key)
|
|
dstVal := dst.MapIndex(key)
|
|
|
if !dstVal.IsValid() {
|
|
if !dstVal.IsValid() {
|
|
|
dstVal = reflect.New(dst.Type().Elem()).Elem()
|
|
dstVal = reflect.New(dst.Type().Elem()).Elem()
|
|
|
|
|
+ dst.SetMapIndex(key, dstVal) // Set the new value directly into the map
|
|
|
}
|
|
}
|
|
|
// Recursive call to handle potential nested maps or structs
|
|
// Recursive call to handle potential nested maps or structs
|
|
|
if err := recursiveUpdate(dstVal, srcVal); err != nil {
|
|
if err := recursiveUpdate(dstVal, srcVal); err != nil {
|