title: Iterate Struct (map key) value in golang
body: <p>I've looked up <a href="https://stackoverflow.com/questions/21064244/structs-as-keys-in-golang-maps">Structs as keys in Golang maps</a></p>
  
  <p>I understand iteration over the maps in golang has no guaranteed order. I've followed the <a href="https://blog.golang.org/go-maps-in-action#TOC_7." rel="nofollow noreferrer">example in golang blog</a>, and tried using a <code>struct</code> as a map key.</p>
  
  <p>Here's my code</p>
  
  <pre><code>package main
  
  func main() {
      req := make(map[mapKey]string)
  
      req[mapKey{1, "r"}] = "robpike"
      req[mapKey{2, "gri"}] = "robert griesemer"
      req[mapKey{3, "adg"}] = "andrew gerrand"
      req[mapKey{4, "rsc"}] = "russ cox"
  
      var keys []int
      for k := range req {
          keys = append(keys, k.Key)
      }
  
      for _, k := range keys {
          fmt.Printf("short name : %s , long name : %s\n",req[k], req[k]) // How do I iterate here
      }
  
      sort.Ints(keys)
  }
  
  type mapKey struct {
      Key    int
      Option string
  }
  </code></pre>
  
  <p>What I want the results to be is </p>
  
  <pre><code>short name : r , long name : rob pike
  short name : gri , long name : robert griesemer
  short name : adg , long name : andrew gerrand
  short name : rsc , long name : russ cox
  </code></pre>
  
  <p>And I don't know how I can get the struct value and key iterated by separated data structure.</p>