Skip to content
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

testing: enforce the documented restriction on fuzz target result parameters #51222

Closed
findleyr opened this issue Feb 16, 2022 · 4 comments
Closed
Labels
NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Feb 16, 2022

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.

CC @golang/release @bcmills

@findleyr findleyr added this to the Go1.18 milestone Feb 16, 2022
@findleyr
Copy link
Contributor Author

findleyr commented Feb 16, 2022

(CC @julieqiu as well).

@gopherbot
Copy link

gopherbot commented Feb 16, 2022

Change https://go.dev/cl/386175 mentions this issue: testing: panic in Fuzz if the function returns a value

@bcmills bcmills self-assigned this Feb 16, 2022
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 16, 2022
@bcmills
Copy link
Member

bcmills commented Feb 16, 2022

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.)

@findleyr
Copy link
Contributor Author

findleyr commented Feb 16, 2022

Since the API is already documented to require “no return value” it's not technically an API change

Indeed, I probably should have said "observable change" :)

@bcmills bcmills changed the title cmd/go: enforce the documented restriction on fuzz target result parameters testing: enforce the documented restriction on fuzz target result parameters Feb 16, 2022
@rsc rsc unassigned bcmills Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants