From e107128b7d292d7f86e9a8f9ad2e2f08dd534f7b Mon Sep 17 00:00:00 2001 From: lucklove Date: Wed, 7 Apr 2021 11:21:11 +0800 Subject: [PATCH] Fix lint --- pkg/cluster/spec/server_config.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/cluster/spec/server_config.go b/pkg/cluster/spec/server_config.go index 310a7a1981..9ae35a9fa0 100644 --- a/pkg/cluster/spec/server_config.go +++ b/pkg/cluster/spec/server_config.go @@ -143,6 +143,23 @@ func FlattenMap(ms map[string]interface{}) map[string]interface{} { return result } +// MergeConfig merge two or more config into one and unflat them +// config1: +// a.b.a: 1 +// a.b.b: 2 +// config2: +// a.b.a: 3 +// a.b.c: 4 +// config3: +// b.c = 5 +// After MergeConfig(config1, config2, config3): +// a: +// b: +// a: 3 +// b: 2 +// c: 4 +// b: +// c: 5 func MergeConfig(orig map[string]interface{}, overwrites ...map[string]interface{}) map[string]interface{} { lhs := FoldMap(orig) for _, overwrite := range overwrites {