bxcodec/faker

`slice_len` only works for `string`

trynity opened this issue · 0 comments

Right now, slice_len does not actually work for a slice of integers/bytes, despite what the example has: https://github.com/bxcodec/faker/blob/master/example_with_tags_slicelength_test.go

If you add a slice of integers to the test: https://github.com/bxcodec/faker/blob/master/faker_test.go#L650

It will fail with "Invalid Tags" here: https://github.com/bxcodec/faker/blob/master/faker.go#L921

The reason you don't see similar with Strings is because the similar check in extractStringFromTag, we always have lang set: https://github.com/bxcodec/faker/blob/master/faker.go#L858

I wasn't sure how best to approach this, whether we should just have a check accepting slice_len as an additional tag in extractNumberFromTag or some other cleaner way, but dem's de facts.