diff --git a/README.md b/README.md index d1577a8..18d68c2 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ func main(){ t := reflect.TypeOf(m) for i := 0; i < t.NumField(); i++ { - widget:=tagfast.Tag(m,i,"form_widget") + widget:=tagfast.Tag(t,i,"form_widget") fmt.Println("widget:",widget) - valid:=tagfast.Tag(m,i,"valid") + valid:=tagfast.Tag(t,i,"valid") fmt.Println("valid:",valid) - xorm:=tagfast.Tag(m,i,"xorm") + xorm:=tagfast.Tag(t,i,"xorm") fmt.Println("xorm:",xorm) } diff --git a/tagfast.go b/tagfast.go index 63994e3..e02ec1c 100644 --- a/tagfast.go +++ b/tagfast.go @@ -31,9 +31,8 @@ func GetTag(struct_name string, field_name string) (r TagFast, ok bool) { return } -//usage: Tag(m,i,"form") -func Tag(i_struct interface{}, field_no int, key string) (tag string) { - t := reflect.TypeOf(i_struct) +//usage: Tag(t, i, "form") +func Tag(t reflect.Type, field_no int, key string) (tag string) { if t.Field(field_no).Tag == "" { return "" }