Skip to content

Commit cd4e9df

Browse files
errors: deprecate functions that are now in standard library
Change-Id: I8dc2a0d3923fdd55bcc205eea99142b1a32d569d Reviewed-on: https://go-review.googlesource.com/c/xerrors/+/399607 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 5ec99f8 commit cd4e9df

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

fmt.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const percentBangString = "%!"
3333
// It is invalid to include more than one %w verb or to supply it with an
3434
// operand that does not implement the error interface. The %w verb is otherwise
3535
// a synonym for %v.
36+
//
37+
// Deprecated: As of Go 1.13, use fmt.Errorf instead.
3638
func Errorf(format string, a ...interface{}) error {
3739
format = formatPlusW(format)
3840
// Support a ": %[wsv]" suffix, which works well with xerrors.Formatter.

wrap.go

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func (e noWrapper) FormatError(p Printer) (next error) {
3535

3636
// Unwrap returns the result of calling the Unwrap method on err, if err implements
3737
// Unwrap. Otherwise, Unwrap returns nil.
38+
//
39+
// Deprecated: As of Go 1.13, use errors.Unwrap instead.
3840
func Unwrap(err error) error {
3941
u, ok := err.(Wrapper)
4042
if !ok {
@@ -47,6 +49,8 @@ func Unwrap(err error) error {
4749
//
4850
// An error is considered to match a target if it is equal to that target or if
4951
// it implements a method Is(error) bool such that Is(target) returns true.
52+
//
53+
// Deprecated: As of Go 1.13, use errors.Is instead.
5054
func Is(err, target error) bool {
5155
if target == nil {
5256
return err == target
@@ -77,6 +81,8 @@ func Is(err, target error) bool {
7781
//
7882
// The As method should set the target to its value and return true if err
7983
// matches the type to which target points.
84+
//
85+
// Deprecated: As of Go 1.13, use errors.As instead.
8086
func As(err error, target interface{}) bool {
8187
if target == nil {
8288
panic("errors: target cannot be nil")

0 commit comments

Comments
 (0)