package main
import (
"reflect"
)
type User struct {
Name string `t1:"hello" t2:"萨瓦迪卡" t3:"你好"`
}
func main() {
u := User{Name: "张三"}
typ := reflect.TypeOf(u)
fid := typ.Field(0)
println(fid.Tag)
println(reflect.ValueOf(fid.Tag).Kind().String())
println(fid.Tag.Get("t1"))
println(fid.Tag.Lookup("t2"))
}
t1:"hello" t2:"萨瓦迪卡" t3:"你好"
string
hello
萨瓦迪卡 true