From 209536aa46a4be03955744bd9596240d339ceb0d Mon Sep 17 00:00:00 2001 From: Roarke Gaskill Date: Wed, 4 Mar 2020 11:32:51 -0600 Subject: [PATCH] convert slice types --- faker.go | 1 + faker_test.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/faker.go b/faker.go index d9254f2..1844154 100644 --- a/faker.go +++ b/faker.go @@ -447,6 +447,7 @@ func getValue(a interface{}) (reflect.Value, error) { if err != nil { return reflect.Value{}, err } + val = val.Convert(v.Index(i).Type()) v.Index(i).Set(val) } return v, nil diff --git a/faker_test.go b/faker_test.go index a134509..1375f85 100644 --- a/faker_test.go +++ b/faker_test.go @@ -14,6 +14,8 @@ const ( someStructBoundaryEnd = 10 ) +type SomeInt32 int32 + type SomeStruct struct { Inta int Int8 int8 @@ -61,6 +63,8 @@ type SomeStruct struct { MapStringString map[string]string MapStringStruct map[string]AStruct MapStringStructPointer map[string]*AStruct + + SomeInt32s []SomeInt32 } type SomeStructWithLen struct {