Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
fix: convert slice types (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaskill authored Apr 18, 2020
1 parent 7198e34 commit 1c6d6ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions faker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions faker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const (
someStructBoundaryEnd = 10
)

type SomeInt32 int32

type SomeStruct struct {
Inta int
Int8 int8
Expand Down Expand Up @@ -61,6 +63,8 @@ type SomeStruct struct {
MapStringString map[string]string
MapStringStruct map[string]AStruct
MapStringStructPointer map[string]*AStruct

SomeInt32s []SomeInt32
}

type SomeStructWithLen struct {
Expand Down

0 comments on commit 1c6d6ed

Please sign in to comment.