In this post, we will see how to resolve set value of map1 and map2 through a reflector pointer
Question:
test my exemple code: https://go.dev/play/p/G7LxjDNjNAnterminal result:
have change in A and B. whoever helped me with the “Set” function sent a code. Hope you send too. For some reason it worked, now it doesn’t.
I can’t assign to the map, because this function was made in such a way that I cannot even know if the value comes from an array if it is a variable or a map tag
the “Set” function works for different types https://go.dev/play/p/TggxPxF5kx9
one way i’m sure would work is to create a pointer pointer, not being a map pointer, a pointer that points to the pointer that points to the value of the 2 maps
the “Set” function is based on setting the pointer to the other pointer. I think the error is that I’m pointing to the wrong pointer
Best Answer:
I conceived, when creating the value I create two pointers to that value, that is ** and that way to change. thanks: @JimBIf you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com