From d8d9d87573dddb9676042575f87da0a688656cfa Mon Sep 17 00:00:00 2001 From: Sam Woodard Date: Fri, 10 Jul 2015 08:30:59 -0700 Subject: [PATCH] simplification, whitespace --- request.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/request.go b/request.go index 1df28ea..9cacf51 100644 --- a/request.go +++ b/request.go @@ -124,25 +124,24 @@ func unmarshalJsonApiNode(data *JsonApiNode, model reflect.Value) error { if isSlice { data := relationship["data"].([]interface{}) - models := reflect.New(fieldValue.Type()).Elem() for _, r := range data { m := reflect.New(fieldValue.Type().Elem().Elem()) h := r.(map[string]interface{}) + if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil { er = err return false } + models = reflect.Append(models, m) } fieldValue.Set(models) } else { - data := relationship["data"].(interface{}) - m := reflect.New(fieldValue.Type().Elem()) - h := data.(map[string]interface{}) + h := relationship["data"].(map[string]interface{}) if err := unmarshalJsonApiNode(mapToJsonApiNode(h), m); err != nil { er = err