From 87c6b8e5b5a83ae51b4de974b0262aa0e08b5c03 Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Wed, 28 Mar 2018 15:14:32 +0200 Subject: [PATCH] Fixed format types --- request.go | 4 ++-- request_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/request.go b/request.go index a830bb1..93275a7 100644 --- a/request.go +++ b/request.go @@ -254,10 +254,10 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node) } // As a final catch-all, ensure types line up to avoid a runtime panic. - if fieldValue.Kind() != v.Kind() { + if fieldValue.Kind() != value.Kind() { return ErrInvalidType } - assignValue(fieldValue, reflect.ValueOf(val)) + assignValue(fieldValue, value) } else if annotation == annotationRelation { isSlice := fieldValue.Type().Kind() == reflect.Slice diff --git a/request_test.go b/request_test.go index 2a8e48b..a3e52f9 100644 --- a/request_test.go +++ b/request_test.go @@ -799,17 +799,17 @@ func TestUnmarshalCustomTypeAttributes(t *testing.T) { } if expected, actual := customInt, customAttributeTypes.Int; expected != actual { - t.Fatalf("Was expecting custom int to be `%s`, got `%s`", expected, actual) + t.Fatalf("Was expecting custom int to be `%d`, got `%d`", expected, actual) } if expected, actual := customInt, *customAttributeTypes.IntPtr; expected != actual { - t.Fatalf("Was expecting custom int pointer to be `%s`, got `%s`", expected, actual) + t.Fatalf("Was expecting custom int pointer to be `%d`, got `%d`", expected, actual) } if customAttributeTypes.IntPtrNull != nil { - t.Fatalf("Was expecting custom int pointer to be , got `%s`", customAttributeTypes.IntPtrNull) + t.Fatalf("Was expecting custom int pointer to be , got `%d`", customAttributeTypes.IntPtrNull) } if expected, actual := customFloat, customAttributeTypes.Float; expected != actual { - t.Fatalf("Was expecting custom float to be `%s`, got `%s`", expected, actual) + t.Fatalf("Was expecting custom float to be `%f`, got `%f`", expected, actual) } if expected, actual := customString, customAttributeTypes.String; expected != actual { t.Fatalf("Was expecting custom string to be `%s`, got `%s`", expected, actual)