summaryrefslogtreecommitdiffstats
path: root/app/generated by cgit v1.2.3 (git 2.25.1) at 2024-08-01 13:28:12 +0000
lue{}, false } func mergeMap(dst, src reflect.Value) reflect.Value { out := reflect.MakeMap(dst.Type()) // Copy the destination map. for _, key := range dst.MapKeys() { v := dst.MapIndex(key) out.SetMapIndex(key, v) } // Add all keys in src not already in destination. // Maps of the same type will be merged. for _, key := range src.MapKeys() { sv := src.MapIndex(key) dv, found := caseInsensitiveLookup(dst, key) if found { // If both are the same map type, merge. dve := dv.Elem() if dve.Kind() == reflect.Map { sve := sv.Elem() if dve.Type() == sve.Type() { out.SetMapIndex(key, mergeMap(dve, sve)) } } } else { out.SetMapIndex(key, sv) } } return out }