From 6f51082da77a1d4cafd5b7af0db69293943f4066 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20M=C3=B6hrmann?= Date: Wed, 22 May 2019 14:27:47 +0200 Subject: [PATCH] fmt: always clear wrapErrs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 TryBot-Result: Gobot Gobot Reviewed-by: Damien Neil --- src/fmt/print.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fmt/print.go b/src/fmt/print.go index 3253e8042e..595869140a 100644 --- a/src/fmt/print.go +++ b/src/fmt/print.go @@ -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 @@ -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 } -- 2.50.0