]> Cypherpunks repositories - gostls13.git/commitdiff
os: remove document duplication in error predicate functions
authorShenghou Ma <minux.ma@gmail.com>
Tue, 13 Mar 2012 05:48:07 +0000 (13:48 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Tue, 13 Mar 2012 05:48:07 +0000 (13:48 +0800)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5783092

src/pkg/os/error.go
src/pkg/os/error_plan9.go
src/pkg/os/error_posix.go
src/pkg/os/error_windows.go

index e0b83b5c22cabf46a586d0235fa036f179b17ae9..54c2dc63990ffd7435835fbe0d04ded87562be17 100644 (file)
@@ -42,3 +42,21 @@ func NewSyscallError(syscall string, err error) error {
        }
        return &SyscallError{syscall, err}
 }
+
+// IsExist returns whether the error is known to report that a file already exists.
+// It is satisfied by ErrExist as well as some syscall errors.
+func IsExist(err error) bool {
+       return isExist(err)
+}
+
+// IsNotExist returns whether the error is known to report that a file does not exist.
+// It is satisfied by ErrNotExist as well as some syscall errors.
+func IsNotExist(err error) bool {
+       return isNotExist(err)
+}
+
+// IsPermission returns whether the error is known to report that permission is denied.
+// It is satisfied by ErrPermission as well as some syscall errors.
+func IsPermission(err error) bool {
+       return isPermission(err)
+}
index 159d685e7cdb845b09212cfa3ae96ea657c37fd8..3c9dfb0b158b6381d73a8c7ea63303aebd9ca47e 100644 (file)
@@ -4,24 +4,21 @@
 
 package os
 
-// IsExist returns whether the error is known to report that a file already exists.
-func IsExist(err error) bool {
+func isExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
        return contains(err.Error(), " exists")
 }
 
-// IsNotExist returns whether the error is known to report that a file does not exist.
-func IsNotExist(err error) bool {
+func isNotExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
        return contains(err.Error(), "does not exist")
 }
 
-// IsPermission returns whether the error is known to report that permission is denied.
-func IsPermission(err error) bool {
+func isPermission(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
index d08ad5db167f7731beba250c6e6340b87b76ac9b..1685c1f2132287caa221566f8afc36a888b215d8 100644 (file)
@@ -8,27 +8,21 @@ package os
 
 import "syscall"
 
-// IsExist returns whether the error is known to report that a file already exists.
-// It is satisfied by ErrExist as well as some syscall errors.
-func IsExist(err error) bool {
+func isExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
        return err == syscall.EEXIST || err == ErrExist
 }
 
-// IsNotExist returns whether the error is known to report that a file does not exist.
-// It is satisfied by ErrNotExist as well as some syscall errors.
-func IsNotExist(err error) bool {
+func isNotExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
        return err == syscall.ENOENT || err == ErrNotExist
 }
 
-// IsPermission returns whether the error is known to report that permission is denied.
-// It is satisfied by ErrPermission as well as some syscall errors.
-func IsPermission(err error) bool {
+func isPermission(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
index 84bf5eae8aed54df01a9ad0912447ebe6aa2e7a4..b8b894b5a29aad37aa6de6e65d1890ab1598345d 100644 (file)
@@ -6,9 +6,7 @@ package os
 
 import "syscall"
 
-// IsExist returns whether the error is known to report that a file already exists.
-// It is satisfied by ErrExist as well as some syscall errors.
-func IsExist(err error) bool {
+func isExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
@@ -16,18 +14,14 @@ func IsExist(err error) bool {
                err == syscall.ERROR_FILE_EXISTS || err == ErrExist
 }
 
-// IsNotExist returns whether the error is known to report that a file does not exist.
-// It is satisfied by ErrNotExist as well as some syscall errors.
-func IsNotExist(err error) bool {
+func isNotExist(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }
        return err == syscall.ENOENT || err == ErrNotExist
 }
 
-// IsPermission returns whether the error is known to report that permission is denied.
-// It is satisfied by ErrPermission as well as some syscall errors.
-func IsPermission(err error) bool {
+func isPermission(err error) bool {
        if pe, ok := err.(*PathError); ok {
                err = pe.Err
        }