title: Struct field tag `name` not compatible with reflect.StructTag.Get: bad syntax for struct tag pair
body: <p>I read <a href="https://stackoverflow.com/q/59959839/2441637">this</a>, but it is different than my case, I've the below code:</p>
  <pre class="lang-golang prettyprint-override"><code>package main
  
  import (
      &quot;bytes&quot;
      &quot;fmt&quot;
      &quot;reflect&quot;
      &quot;strconv&quot;
      &quot;strings&quot;
  )
  
  type User struct {
      Name string `name`
      Age  int64  `age`
  }
  
  func main() {
      var u User = User{&quot;bob&quot;, 10}
  
      res, err := JSONEncode(u)
      if err != nil {
          panic(err)
      }
      fmt.Println(string(res))
  
  }
  
  func JSONEncode(v interface{}) ([]byte, error) {
      refObjVal := reflect.ValueOf(v)
      refObjTyp := reflect.TypeOf(v)
      buf := bytes.Buffer{}
      if refObjVal.Kind() != reflect.Struct {
          return buf.Bytes(), fmt.Errorf(
              &quot;val of kind %s is not supported&quot;,
              refObjVal.Kind(),
          )
      }
      buf.WriteString(&quot;{&quot;)
      pairs := []string{}
      for i := 0; i &lt; refObjVal.NumField(); i++ {
          structFieldRefObj := refObjVal.Field(i)
          structFieldRefObjTyp := refObjTyp.Field(i)
  
          switch structFieldRefObj.Kind() {
          case reflect.String:
              strVal := structFieldRefObj.Interface().(string)
              pairs = append(pairs, `&quot;`+string(structFieldRefObjTyp.Tag)+`&quot;:&quot;`+strVal+`&quot;`)
          case reflect.Int64:
              intVal := structFieldRefObj.Interface().(int64)
              pairs = append(pairs, `&quot;`+string(structFieldRefObjTyp.Tag)+`&quot;:`+strconv.FormatInt(intVal, 10))
          default:
              return buf.Bytes(), fmt.Errorf(
                  &quot;struct field with name %s and kind %s is not supprted&quot;,
                  structFieldRefObjTyp.Name,
                  structFieldRefObj.Kind(),
              )
          }
      }
  
      buf.WriteString(strings.Join(pairs, &quot;,&quot;))
      buf.WriteString(&quot;}&quot;)
  
      return buf.Bytes(), nil
  }
  </code></pre>
  <p>It works perfectly, and give output as:</p>
  <pre class="lang-bash prettyprint-override"><code>{&quot;name&quot;:&quot;bob&quot;,&quot;age&quot;:10}
  </code></pre>
  <p>But as VS code, it gives me the below problems:</p>
  <p><a href="https://i.stack.imgur.com/G8okK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G8okK.png" alt="enter image description here" /></a></p>
  <p>What could be the issue?</p>