printf analyzer: link to fmt#Printing for verb/type docs

Folks are reporting the current error message as not useful,
remarking that they don’t know which formatting verb goes with
which Go type, see e.g. b/227741360.

Change-Id: I367bc8c4df3521f0726dc4defa4e563532706148
Reviewed-on: https://go-review.googlesource.com/c/tools/+/422854
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Michael Stapelberg 2022-08-11 13:23:58 +02:00
parent c4ec74a5c9
commit 88d981ef8f
1 changed files with 1 additions and 1 deletions

View File

@ -915,7 +915,7 @@ func okPrintfArg(pass *analysis.Pass, call *ast.CallExpr, state *formatState) (o
if reason != "" {
details = " (" + reason + ")"
}
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s, see also https://pkg.go.dev/fmt#hdr-Printing", state.name, state.format, analysisutil.Format(pass.Fset, arg), typeString, details)
return false
}
if v.typ&argString != 0 && v.verb != 'T' && !bytes.Contains(state.flags, []byte{'#'}) {