summaryrefslogtreecommitdiffstats
path: root/common/maps/maps.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/maps/maps.go')
-rw-r--r--common/maps/maps.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/common/maps/maps.go b/common/maps/maps.go
index f0fd3d5ce..2686baad6 100644
--- a/common/maps/maps.go
+++ b/common/maps/maps.go
@@ -29,7 +29,7 @@ func ToStringMapE(in any) (map[string]any, error) {
case Params:
return vv, nil
case map[string]string:
- var m = map[string]any{}
+ m := map[string]any{}
for k, v := range vv {
m[k] = v
}
@@ -192,21 +192,20 @@ func (KeyRenamer) keyPath(k1, k2 string) string {
}
func (r KeyRenamer) renamePath(parentKeyPath string, m map[string]any) {
- for key, val := range m {
- keyPath := r.keyPath(parentKeyPath, key)
- switch val.(type) {
+ for k, v := range m {
+ keyPath := r.keyPath(parentKeyPath, k)
+ switch vv := v.(type) {
case map[any]any:
- val = cast.ToStringMap(val)
- r.renamePath(keyPath, val.(map[string]any))
+ r.renamePath(keyPath, cast.ToStringMap(vv))
case map[string]any:
- r.renamePath(keyPath, val.(map[string]any))
+ r.renamePath(keyPath, vv)
}
newKey := r.getNewKey(keyPath)
if newKey != "" {
- delete(m, key)
- m[newKey] = val
+ delete(m, k)
+ m[newKey] = v
}
}
}