cmd/vet: printf analyzer cannot analyze anonymous functions #44350
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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: