Closed donatorsky closed 2 years ago
@donatorsky thanks for the reporting, this seems to be also the root cause of another issue, I'll check it.
I released a fix that potentially would fix this issue, could you try to update to v1.10.2
and try again?
@jaswdr Can confirm, it worked for me! 🙂
thanks for confirming @donatorsky, I'm resolving this issue for now, but feel free to reopen it if you see it again.
Hi! First and foremost, I'd like to thank You an amazing work :) I've been on PHP's side for a long time, where I was using Faker a lot. After switching to Go world, this faker is definitely the easiest and most convenient to use. I haven't seen any issue reported regarding
Uint()
, so here is what I found out.Describe the bug Calling
Faker.Uint()
panics.To Reproduce
Expected behavior
UInt()
returns a randomuint
value.Screenshots
Desktop (please complete the following information):
go version
output: go version go1.17.6 darwin/amd64Additional context I was able to debug, that
UInt()
callsIntBetween(0, maxValueOf_int_type)
, andIntBetween()
is later callingf.Generator.Intn(diff+1)
. Thediff+1
is the problem here since it overflowsint
type max value and, in the end, whenrand.Intn()
receives negative value, it panics.I'm also attaching a few screenshots from debugging chain.