Commit 6f51082d authored by Martin Möhrmann's avatar Martin Möhrmann

fmt: always clear wrapErrs

Like panicking and erroring - wrapErrs should always be reset to
the default false. wrapErrs should only be true when set by Errorf.

Change-Id: I4d51cc2f0905109e232b0983dc5331bd34f138bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/178517
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDamien Neil <dneil@google.com>
parent 3e9d8e2e
...@@ -122,7 +122,7 @@ type pp struct { ...@@ -122,7 +122,7 @@ type pp struct {
panicking bool panicking bool
// erroring is set when printing an error string to guard against calling handleMethods. // erroring is set when printing an error string to guard against calling handleMethods.
erroring bool erroring bool
// wrapErrors is set when the format string may contain a %w verb. // wrapErrs is set when the format string may contain a %w verb.
wrapErrs bool wrapErrs bool
// wrappedErr records the target of the %w verb. // wrappedErr records the target of the %w verb.
wrappedErr error wrappedErr error
...@@ -137,6 +137,7 @@ func newPrinter() *pp { ...@@ -137,6 +137,7 @@ func newPrinter() *pp {
p := ppFree.Get().(*pp) p := ppFree.Get().(*pp)
p.panicking = false p.panicking = false
p.erroring = false p.erroring = false
p.wrapErrs = false
p.fmt.init(&p.buf) p.fmt.init(&p.buf)
return p return p
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment