-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/vet: Use function signature to find format string index.
cmd/vet's printf checker currently uses a hardcoded map of function names to expected positions of format strings. We can be a bit more precise than this by looking up the signature of the function, which helps when libraries implement functions like Errorf or Logf with extra arguments like log levels or error codes. Specifically, the format string param is assumed to be the last string parameter of the called function. Fixes #12294. Change-Id: Icf10ebb819bba91fa1c4109301417042901e34c7 Reviewed-on: https://go-review.googlesource.com/20163 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
- Loading branch information
Showing
2 changed files
with
67 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters