title: Golang get struct's field name by JSON tag
body: <p>I have a struct:</p>
  
  <pre><code>type Human struct {
      Head  string  `json:"a1"`
      Body  string  `json:"a2"`
      Leg   string  `json:"a3"`
  }
  </code></pre>
  
  <p>How can I get the struct's field name by providing JSON tag name? Probably something like this:</p>
  
  <pre><code>fmt.Println(getFieldName("a1")) // "Head"
  fmt.Println(getFieldName("a2")) // "Body"
  fmt.Println(getFieldName("a99")) // ""
  
  func getFieldName(tag string) (fieldname string) {
      /* ... */
  }
  </code></pre>
  
  <p>How should I implement the <code>getFieldName</code> function? I read online, it seems I need to use the <code>reflect</code> package, hmmm... any helping hand? :)</p>