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
cmd/go: test -fuzz gives a confusing error when types mismatch #48635
Comments
Another reason the current error is confusing is that |
(forgot to cc @katiehockman @jayconrod on this one, doing so quietly during the quiet week...) |
I just ran into this as well. I hope the message can be improved before 1.18; I suspect that many people are going to see it when they use fuzzing for the first time. In my case, I had something like this:
which led to this confusing message:
Simply adding quotes helps a lot:
Both of @mvdan's suggestions are better yet:
|
Change https://golang.org/cl/361114 mentions this issue: |
Thank you! Certainly a simple change, but will be nice for the UX :) |
I wrote a fuzz func like:
Then I used f.Add as follows:
I got a fairly confusing error:
Intuitively, I thought my code was right, because the untyped constant
0
can be assigned touint8
anduint16
just fine. It took me a minute to realise that, when passing0
as an argument, it assumes theint
type.I think the following error message would be much easier to understand:
or, if you want to include the values:
The text was updated successfully, but these errors were encountered: