File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11package algorithms
22
3- func Merge (m1 , m2 map [string ]interface {}) map [string ]interface {} {
3+ func Merge (maps ... map [string ]interface {}) map [string ]interface {} {
4+ res := maps [0 ]
5+ for _ , m := range maps [1 :] {
6+ res = deepMerge (res , m )
7+ }
8+
9+ return res
10+ }
11+
12+ func deepMerge (m1 , m2 map [string ]interface {}) map [string ]interface {} {
413 // lifted from helm's merge code
514 out := make (map [string ]interface {}, len (m1 ))
615 for k , v := range m1 {
@@ -11,7 +20,7 @@ func Merge(m1, m2 map[string]interface{}) map[string]interface{} {
1120 if v , ok := v .(map [string ]interface {}); ok {
1221 if bv , ok := out [k ]; ok {
1322 if bv , ok := bv .(map [string ]interface {}); ok {
14- out [k ] = Merge (bv , v )
23+ out [k ] = deepMerge (bv , v )
1524 continue
1625 }
1726 }
You can’t perform that action at this time.
0 commit comments