type resume struct {
Name string `info:"name" doc:"PlutoWu"`
Sex string `info:"sex" doc:"Male"`
Role string `info:"role" doc:"SoftwareEngineer"`
ChineseName string `info:"chineseName" doc:"Shiyuan Wu"`
}
func findTag(str interface{}) {
t := reflect.TypeOf(str).Elem()
for i := 0; i < t.NumField(); i {
taginfo := t.Field(i).Tag.Get("info")
tagdoc := t.Field(i).Tag.Get("doc")
fmt.Println("info:", taginfo, "doc:", tagdoc)
}
}
func main() {
var re resume
findTag(&re)
}
Pinned Loading
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.