Open EmilyEmily opened 5 years ago
On the other hand, if teststr value has different keys from the map, then there is no error:
testStr := string("m2new.key2.key1=200")
Output is:
testStr: m2new.key2.key1=200
map1: map[addr:China age:12 name:simon m2:map[key2:map[key1:1 key12:12]]]
after parse: map[addr:China age:12 name:simon m2:map[key2:map[key1:1 key12:12]] m2new:map[key2:map[key1:200]]]
My third test is to verify that if the testStr has simple key/value pair but not multi-layer key, then strvals.ParseInto(testStr,m1) will merge the testStr and m1 together without error:
testStr := string("age=300,name=newname")
Output is:
testStr: age=300, name=newname
map1: map[age:12 name:simon m2:map[key2:map[key1:1 key12:12]]]
after parse: map[age:300 name:newname m2:map[key2:map[key1:1 key12:12]] ]
In one word, from above test, strvals.ParseInto() can't merge multi-layer key/value from the first parameter string to the second parameter map.
Since bcf deployer doesn't rely on this function, we can set this issue to low priority.
This seems a bug from go package strvals. To simplify the issue, I wrote test code for this package:
Output is