Skip to content

Commit f6b0046

Browse files
committed
update
1 parent 5a8b47c commit f6b0046

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

reflect.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
)
88

9-
//TestReflect 测试反射:显示字段和方法信息
9+
// TestReflect 测试反射:显示字段和方法信息
1010
func TestReflect(v interface{}) {
1111
val := reflect.ValueOf(v)
1212
typ := val.Type()
@@ -34,9 +34,11 @@ func TestReflect(v interface{}) {
3434
extInfo = append(extInfo, `anonymous`)
3535
}
3636
if vv.CanInterface() {
37-
fmt.Printf("Type: %v => %v (%v); Index: %v; Field name: %v\n", vv.Kind(), vv.Interface(), strings.Join(extInfo, `,`), i, vt.Name)
37+
fmt.Printf("Type: %v => %v (%v); Index: %v; Field name: %v; Tag: %v\n", vv.Kind(), vv.Interface(), strings.Join(extInfo, `,`), i, vt.Name,
38+
vt.Tag)
3839
} else {
39-
fmt.Printf("Type: %v => %v (%v); Index: %v; Field name: %v\n", vv.Kind(), "<unexported>", strings.Join(extInfo, `,`), i, vt.Name)
40+
fmt.Printf("Type: %v => %v (%v); Index: %v; Field name: %v; Tag: %v\n", vv.Kind(), "<unexported>", strings.Join(extInfo, `,`), i, vt.Name,
41+
vt.Tag)
4042
}
4143
}
4244
fmt.Println("==================[/" + name + "]==================")

0 commit comments

Comments
 (0)