Fix: parse dial interface option

This commit is contained in:
Dreamacro
2021-11-08 13:29:37 +08:00
parent d40e5e4fe6
commit e622d8dd38
3 changed files with 37 additions and 35 deletions

View File

@ -37,6 +37,12 @@ func (d *Decoder) Decode(src map[string]interface{}, dst interface{}) error {
v := reflect.ValueOf(dst).Elem()
for idx := 0; idx < v.NumField(); idx++ {
field := t.Field(idx)
if field.Anonymous {
if err := d.decodeStruct(field.Name, src, v.Field(idx)); err != nil {
return err
}
continue
}
tag := field.Tag.Get(d.option.TagName)
str := strings.SplitN(tag, ",", 2)