🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Struct Tag === ![](https://box.kancloud.cn/a27aa80e2a4a99db69351c8276824100_754x166.png) 测试结构体 ~~~ type Employee struct { EmployeeId string Name string `format:"normal,bs"` Age int } ~~~ 获取tag并获取tag所对应的值 ``` e := Employee{} name := reflect.ValueOf(*e).FieldByName("Name") field,_ :=reflect.TypeOf(*e).FieldByName("Name") tag := field.Tag.Get("format") // 获取到tag的格式是string ``` ![](https://box.kancloud.cn/8bb83377d5c7221e24ab118856df54ff_1035x294.png)