jeudi 8 avril 2021

how to update a map value by reflection

I encountered a problem, I expect to make a general method to update the value in the map, as in the below example:

Code In Answers1

The expected output result is:

inner: map[0:map[name:test]]
outer: map[0:map[name:test]]
inner: map[0:map[age:1]]
outer: map[0:map[age:1]]

But the actual output is:

outer: map[]
outer: map[]

How can I achieve the expected output?





Aucun commentaire:

Enregistrer un commentaire