I have a navbar as a map:
var navbar = map[string]navbarTab{
}
Where navbarTab
has various properties, child items and so on. When I try to render the navbar (with for tabKey := range navbar
) it shows up in a random order. I'm aware range
randomly sorts when it runs but there appears to be no way to get an ordered list of keys or iterate in the insertion order.
The playground link is here: http://play.golang.org/p/nSL1zhadg5 although it seems to not exhibit the same behavior.
How can I iterate over this map without breaking the insertion order?