Skip to content

Commit

Permalink
fmt: always clear wrapErrs
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
  • Loading branch information
martisch committed May 23, 2019
1 parent 3e9d8e2 commit 6f51082
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fmt/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type pp struct {
panicking bool
// erroring is set when printing an error string to guard against calling handleMethods.
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
// wrappedErr records the target of the %w verb.
wrappedErr error
Expand All @@ -137,6 +137,7 @@ func newPrinter() *pp {
p := ppFree.Get().(*pp)
p.panicking = false
p.erroring = false
p.wrapErrs = false
p.fmt.init(&p.buf)
return p
}
Expand Down

0 comments on commit 6f51082

Please sign in to comment.