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

Custom tag: Tag Unsupported #74

Closed
ChristianLindLarsen opened this issue Aug 13, 2019 · 4 comments
Closed

Custom tag: Tag Unsupported #74

ChristianLindLarsen opened this issue Aug 13, 2019 · 4 comments

Comments

@ChristianLindLarsen
Copy link

Example struct field:

Status   string `faker:"Status"`

From the example code provided on the repo:

_ = faker.AddProvider("Status", func(v reflect.Value) (interface{}, error) {
	rand.Seed(time.Now().Unix())
	statuses := []string{
		"APPROVAL",
		"DENIAL",
	}
	n := rand.Int() % len(statuses)

	return statuses[n], nil
})

Result:

    go_test.go:45: Tag unsupported
@bxcodec
Copy link
Owner

bxcodec commented Oct 10, 2019

You have to init the custom provider on function init

@bxcodec
Copy link
Owner

bxcodec commented Oct 10, 2019

Is this issues still happening?

@kkfnui
Copy link

kkfnui commented Mar 25, 2020

I encountered this problem yesterday. I made a stupid mistake.
I import "github.com/bxcodec/faker/v3" where used to add custom tag
And I import "github.com/bxcodec/faker" when call FakeData

@bxcodec
Copy link
Owner

bxcodec commented Jun 4, 2020

closing for no replies

@bxcodec bxcodec closed this as completed Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants