cmd/vet: printf analyzer cannot analyze anonymous functions #44350
Labels
Comments
The question is, how prevalent is the code pattern just described? Could we somehow get data on that to justify the above described extension? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran
go vet
on a package containing the following:What did you expect to see?
go vet
catches the mismatch between the format string and argument list in thefailf
call.What did you see instead?
The package passed vetting.
This pattern of wrapping a printf-family function in a closure can also be found in the Go sources.
go/src/cmd/go/internal/modfetch/coderepo.go
Lines 324 to 332 in 2f0da6d
While I would not expect
go vet
to be able to analyze in general whether a function value wraps (or is) a printf-family function, might it be viable to analyze the more limited case of a function-scoped local variable which is assigned a function literal value?The text was updated successfully, but these errors were encountered: