]> Cypherpunks repositories - gostls13.git/commit
fmt: support %w
authorDamien Neil <dneil@google.com>
Mon, 13 May 2019 23:46:31 +0000 (16:46 -0700)
committerDamien Neil <dneil@google.com>
Wed, 15 May 2019 19:53:28 +0000 (19:53 +0000)
commit14491a2ec499668388d7fe7e95b84dbf0e1cf04d
tree9f195103490db8c82c9a01dc7922738b00205ebc
parent3e2c522d5c712fa2b1d18a101272abefc7dcb074
fmt: support %w

When fmt.Errorf is provided with a %w verb with an error operand,
return an error implementing an Unwrap method returning that operand.

It is invalid to use %w with other formatting functions, to use %w
multiple times in a format string, or to use %w with a non-error
operand. When the Errorf format string contains an invalid use of %w,
the returned error does not implement Unwrap.

Change-Id: I534e20d3b163ab22c2b137b1c9095906dc243221
Reviewed-on: https://go-review.googlesource.com/c/go/+/176998
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
src/fmt/errors.go [new file with mode: 0644]
src/fmt/errors_test.go [new file with mode: 0644]
src/fmt/print.go
src/internal/oserror/errors_test.go