-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: analyze Fuzz targets in the go/analysis/tests analyzer #50198
Comments
We think this is useful outside gopls and we can consider to add this to vet in the future. |
Roughly a dup of #46218. The suggestion for putting this into go/analysis/passes/tests/tests.go is a good one. The only real reason I can see to delay going into cmd/vet is that cmd/vet is under code freeze ATM. |
Let's close this as a dupe. We can start #46218 in gopls, but I think it eventually belongs in vet. |
Err, as I'm putting together [email protected] planning, I think it would be nice to have a tracking issue for just the gopls part of this. Reopening. |
Change https://go.dev/cl/374495 mentions this issue: |
|
This will validate that first letter after FuzzFoo() should be uppercase Also, following validation will be performed for f.Fuzz() calls : 1. f.Fuzz() should call a function and it should be of type (*testing.F).Fuzz(). 2. The called function in f.Fuzz(func(){}) should not return result. 3. First argument of func() should be of type *testing.T 4. Second argument onwards should be of type []byte, string, bool, byte, rune, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64 For golang/go#50198 Change-Id: I540daf635f0fe03d954b010b9b5f8616fd5df47a Reviewed-on: https://go-review.googlesource.com/c/tools/+/374495 Reviewed-by: Robert Findley <[email protected]> Trust: Peter Weinberger <[email protected]>
The function printAcceptedFuzzType was renamed to formatAcceptedFuzzType after PS6 of CL 374495, but the rename was missed in one spot and didn't get caught by TryBots. Updates golang/go#50198 Change-Id: Ib51d26b8c159dbdc3beeac9c7c98f19690e82228 Reviewed-on: https://go-review.googlesource.com/c/tools/+/386314 Trust: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Tim King <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
Change https://go.dev/cl/386314 mentions this issue: |
Marking this as done for gopls/v0.8.0. Have filed #51398 for remaining functionality, which we can perhaps do for [email protected]. |
Change https://go.dev/cl/471295 mentions this issue: |
… for cmd/vet This will remove the flag analysisinternal.DiagnoseFuzzTests created during golang/go#50198.Malformed fuzz target check will be enabled for cmd/vet. For golang/go#46218 Change-Id: I5cc8d685a57060f8dd84c1957f0d296a6205ddb6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/471295 gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Nooras Saba <[email protected]>
Idea came from #46896 (comment)
f.Fuzz takes
any
(akainterface{}
) type but the parameter must be a fuction with no return value whose first argument is *T and whose remaining arguments match the matching testin.F.Add call.Add an analyzer to detect misuse of Fuzz API.
The text was updated successfully, but these errors were encountered: