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

Conversation

@daniel134256
Copy link
Contributor

@daniel134256 daniel134256 commented Aug 11, 2022

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

Avoid `panic: reflect.Value.SetMapIndex: value of type <BUILT-IN TYPE> is not assignable to type <ALIAS TYPE> [recovered]`
Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bxcodec bxcodec merged commit 72e5223 into bxcodec:master Aug 11, 2022
@bxcodec bxcodec changed the title fix panic on using map with value of aliased type fix: panic on using map with value of aliased type Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix panic on using map with value of aliased type

2 participants