I have a map that has an array of maps as its value.
Example:
thisMap["coins"][0] = aMap["random":"something"] thisMap["notes"][1] = aMap["not-random":"something else"] thisMap["coins"][2] = aMap["not-random":"something else"]
I can't figure out how to do this, since go seems to only allow data to be set at one level when dealing with maps [name][value] = value .
So far I have this code that fails
package main func main() { something := []string{"coins", "notes", "gold?", "coins", "notes"} thisMap := make(map[string][]map[string]int) for k, v := range something { aMap := map[string]string{ "random": "something", } thisMap[v] = [k]aMap } }
Change The slice values ("coins", "notes", etc.) can be repeated, so for this I need the index [] .
arrays data-structures go
The user with no hat
source share