title: Ordered iteration in map string string
body: <p>In the Go blog, this is how to print the map in order.</p>
  
  <p><a href="http://blog.golang.org/go-maps-in-action" rel="nofollow noreferrer">http://blog.golang.org/go-maps-in-action</a></p>
  
  <pre><code>      import "sort"
  
        var m map[int]string
        var keys []int
        for k := range m {
            keys = append(keys, k)
        }
        sort.Ints(keys)
        for _, k := range keys {
            fmt.Println("Key:", k, "Value:", m[k])
        }
  </code></pre>
  
  <p>but what if I have the string keys like <code>var m map[string]string</code></p>
  
  <p>I can't figure out how to print out the string in order(not sorted, in order of string creation in map container)</p>
  
  <p>The example is at my playground <a href="http://play.golang.org/p/Tt_CyATTA3" rel="nofollow noreferrer">http://play.golang.org/p/Tt_CyATTA3</a>
  as you can see, it keeps printing the jumbled strings, so I tried map integer values to <code>map[string]string</code> but I still could not figure out how to map each elements of <code>map[string]string</code>.</p>
  
  <p><a href="http://play.golang.org/p/WsluZ3o4qd" rel="nofollow noreferrer">http://play.golang.org/p/WsluZ3o4qd</a></p>