зеркало из https://github.com/golang/tools.git
go/analysis/passes/printf: adjust error message
Rather than stating a neutral-sounding fact (i.e., "Sprintf call has error-wrapping directive %w"), make it more clear why this is wrong (e.g., "Sprintf call has error-wrapping directive %w, which only operates with Errorf") Change-Id: I3417423bcc09e6c9ede9993c33d8420ec57c2a08 Reviewed-on: https://go-review.googlesource.com/c/tools/+/317431 Trust: Joe Tsai <joetsai@digital-static.net> Trust: Joe Tsai <thebrokentoaster@gmail.com> Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Родитель
d1ea2c78a5
Коммит
c0140e85e1
|
@ -590,7 +590,7 @@ func checkPrintf(pass *analysis.Pass, kind Kind, call *ast.CallExpr, fn *types.F
|
|||
}
|
||||
if state.verb == 'w' {
|
||||
if kind != KindErrorf {
|
||||
pass.Reportf(call.Pos(), "%s call has error-wrapping directive %%w", state.name)
|
||||
pass.Reportf(call.Pos(), "%s call has error-wrapping directive %%w, which is only supported by Errorf", state.name)
|
||||
return
|
||||
}
|
||||
if anyW {
|
||||
|
|
Загрузка…
Ссылка в новой задаче