-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nil values #256
Comments
Hi @halturin, Can you please provide a use-case or explanation for what you want to see? I just don't understand what is the result what you want to get from gofakeit. |
Thanks for your reply. i'm just expecting to see kind of [][]float32{nil, []float32{...}, nil, nil} or something. Currently, it fills all the values of any slice. |
As far as I know this is the closest solution, but it's not generating nil values:
I think this requires some modification on the Slice function. |
Unfortunately, it doesn't work. Imagine a multidimensional slice, say [][][][][]float32. It would be great if the Slice method could check the item type using CanAddr method |
@halturin I know it does not work, because I said: "I think this requires some modification on the Slice function." This means that the Slice function does not support such a requirement, so someone needs to add this functionality. :) |
The problem with this is if i randomized a nil in an array of []float32 I would get the same issue from others wondering why im only partially filling out the array. This is more of a user issue than anything. Sounds like you should make your own lookup function and output it the way you want. |
Thanks for the reply. As soon as a slice/map can be nil, it's weird not to have the ability to assign nil as a value. It would be great to have another method like gofakeit.SliceWithNil(...) to add the probability of nil values. Up to you. |
Im good. Thanks. |
I couldn't find how to enable the generation of nil values for my [][]float32 type. Could you please help me with this?
The text was updated successfully, but these errors were encountered: