aboutsummaryrefslogtreecommitdiff
path: root/src/fmt
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2019-02-19 13:03:55 -0800
committerDamien Neil <dneil@google.com>2019-03-20 16:02:01 +0000
commita919b760378343a211719991a9e0b1b819ac9f3d (patch)
tree8dcfc732a1859575e762bafd5baf714ae7ee4af3 /src/fmt
parentaf7b7571c4575748cf8cb2ffe683e97286666e1c (diff)
downloadgo-a919b760378343a211719991a9e0b1b819ac9f3d.tar.gz
go-a919b760378343a211719991a9e0b1b819ac9f3d.zip
os: make errors.Is work with ErrPermission et al.
As proposed in Issue #29934, update errors produced by the os package to work with errors.Is sentinel tests. For example, errors.Is(err, os.ErrPermission) is equivalent to os.IsPermission(err) with added unwrapping support. Move the definition for os.ErrPermission and others into the syscall package. Add an Is method to syscall.Errno and others. Add an Unwrap method to os.PathError and others. Updates #30322 Updates #29934 Change-Id: I95727d26c18a5354c720de316dff0bffc04dd926 Reviewed-on: https://go-review.googlesource.com/c/go/+/163058 Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Diffstat (limited to 'src/fmt')
-rw-r--r--src/fmt/errors_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fmt/errors_test.go b/src/fmt/errors_test.go
index 0183ba77e5..39f247e06d 100644
--- a/src/fmt/errors_test.go
+++ b/src/fmt/errors_test.go
@@ -157,8 +157,8 @@ func TestErrorFormatter(t *testing.T) {
want: "fallback:" +
"\n somefile.go:123" +
"\n - file does not exist:" +
- "\n os.init" +
- "\n .+/os/error.go:\\d\\d",
+ "\n .*" +
+ "\n .+.go:\\d+",
regexp: true,
}, {
err: &wrapped{"outer",