package main
 
import (
    "fmt"
    "reflect"
)
 

type User struct {
    Id int `json:"1"`
    Name string `json:"2" max:"2" `
    Age int `json:"3"`
}
 
 
func (u User) Hello(){
    fmt.Println("Hello world")
}
 

func Info(o interface{}) {
    t := reflect.TypeOf(o)
    fmt.Println("Type: ",t.Name())
 
 
    v :=reflect.ValueOf(o)
    fmt.Println("Filds: ")
 
    for i :=0;i<t.NumField();i++ {
        f :=t.Field(i)
        val := v.Field(i).Interface()
        fmt.Printf("%6s: %v = %v %v %v \n",f.Name,f.Type,val,f.Tag.Get("json"),f.Tag.Get("max"))
    }
 
    for i :=0;i< t.NumMethod();i++ {
        m := t.Method(i)
        fmt.Printf("%6s: %v\n",m.Name,m.Type)
    }
}
 
 
func main(){
    u := User{1,"tom",20}
    Info(u)
}

