Commit 444039e0 authored by Damien Neil's avatar Damien Neil
Browse files

fmt: fix %d and other non-string verbs on errors

When formatting an error with a non-string formatting verb such as %d,
use the default formatting behavior rather than treating this as a bad
verb.

For example, this should print 42, not %!d(main.E=42):

  var E int
  func (E) Error() string { return "error" }
  fmt.Printf("%d", E(42))

Fixes #30472

Change-Id: I62fd309c8ee9839a69052b0ec7f1808449dcee8e
Reviewed-on: https://go-review.googlesource.com/c/164557


Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 72d24a74
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment