]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: always clear wrapErrs
authorMartin Möhrmann <moehrmann@google.com>
Wed, 22 May 2019 12:27:47 +0000 (14:27 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Thu, 23 May 2019 06:16:38 +0000 (06:16 +0000)
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: Damien Neil <dneil@google.com>
src/fmt/print.go

index 3253e8042e22086badd48280ec15b5e34c066c76..595869140a1f9e619745274048182aca104cd0b7 100644 (file)
@@ -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
 }