chore: add more tests (#3324)

This commit is contained in:
Kevin Wan
2023-06-07 00:46:43 +08:00
committed by GitHub
parent d61a55f779
commit 6b4d0d89c0
4 changed files with 201 additions and 64 deletions

View File

@@ -176,7 +176,12 @@ func (u *Unmarshaler) fillSlice(fieldType reflect.Type, value reflect.Value, map
switch dereffedBaseKind {
case reflect.Struct:
target := reflect.New(dereffedBaseType)
if err := u.Unmarshal(ithValue.(map[string]any), target.Interface()); err != nil {
val, ok := ithValue.(map[string]any)
if !ok {
return errTypeMismatch
}
if err := u.Unmarshal(val, target.Interface()); err != nil {
return err
}