//
// An error is considered to match a target if it is equal to that target or if
// it implements a method Is(error) bool such that Is(target) returns true.
+//
+// An error type might provide an Is method so it can be treated as equivalent
+// to an existing error. For example, if MyError defines
+//
+// func (m MyError) Is(target error) bool { return target == os.ErrExist }
+//
+// then Is(MyError{}, os.ErrExist) returns true. See syscall.Errno.Is for
+// an example in the standard library.
func Is(err, target error) bool {
if target == nil {
return err == target
// As(target) returns true. In the latter case, the As method is responsible for
// setting target.
//
-// As will panic if target is not a non-nil pointer to either a type that implements
+// An error type might provide an As method so it can be treated as if it were a
+// a different error type.
+//
+// As panics if target is not a non-nil pointer to either a type that implements
// error, or to any interface type. As returns false if err is nil.
func As(err error, target interface{}) bool {
if target == nil {