You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
testing: enforce the documented restriction on fuzz target result parameters #51222
The documentation for F.Fuzz states that "ff must be a function with no return value", but in practice this is not enforced. For example, the following invocation is accepted:
func FuzzFoo(f *testing.F) {
f.Fuzz(func(t *testing.T, i int) int {
return 0
})
}
We should enforce the documented restriction. If we don't, users will likely depend on the current behavior. We can always relax this restriction in the future.
Marking as a release blocker as this is an API change.
Marking as a release blocker as this is an API change.
Since the API is already documented to require “no return value” it's not technically an API change, but I agree that it should be a release-blocker. (Otherwise, it's too easy for users to accidentally rely on behavior counter to the documentation.)
changed the title [-]cmd/go: enforce the documented restriction on fuzz target result parameters[/-][+]testing: enforce the documented restriction on fuzz target result parameters[/+]on Feb 16, 2022
Activity
findleyr commentedon Feb 16, 2022
(CC @julieqiu as well).
gopherbot commentedon Feb 16, 2022
Change https://go.dev/cl/386175 mentions this issue:
testing: panic in Fuzz if the function returns a valuebcmills commentedon Feb 16, 2022
Since the API is already documented to require “no return value” it's not technically an API change, but I agree that it should be a release-blocker. (Otherwise, it's too easy for users to accidentally rely on behavior counter to the documentation.)
findleyr commentedon Feb 16, 2022
Indeed, I probably should have said "observable change" :)
[-]cmd/go: enforce the documented restriction on fuzz target result parameters[/-][+]testing: enforce the documented restriction on fuzz target result parameters[/+]testing: panic in Fuzz if the function returns a value