bxcodec / faker

Go (Golang) Fake Data Generator for Struct. [Notes]This repository is archived, moved to the new repository https://github.com/go-faker/faker
https://pkg.go.dev/github.com/bxcodec/faker/v4
MIT License
2.09k stars 148 forks source link

fix: panic on using map with value of aliased type #165

Closed daniel134256 closed 2 years ago

daniel134256 commented 2 years ago

The following will panic:

type Name string

func Test() {
    v := map[string]Name{}
    faker.FakeData(&v)
}

output:

panic: reflect.Value.SetMapIndex: value of type string is not assignable to type <package-name>.Name [recovered]

resolves #166