package main

import (
    "fmt"
    "reflect"
)

func main() {
    type User struct {
        UserId   int    `json:"user_json_id" xml:"user_xml_id"`
        UserName string `json:"user_json_name" xml:"user_xml_name"`
    }
    u := &User{UserId: 1, UserName: "haha"}
    t := reflect.TypeOf(u)
    field0 := t.Elem().Field(0)
    fmt.Println(field0.Tag.Get("json")) //user_json_id
    fmt.Println(field0.Tag.Get("xml"))  //user_xml_id
    field1 := t.Elem().Field(1)
    fmt.Println(field1.Tag.Get("json")) //user_json_name
    fmt.Println(field1.Tag.Get("xml"))  //user_xml_name
}