summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2012-03-13 13:48:07 +0800
committerShenghou Ma <minux.ma@gmail.com>2012-03-13 13:48:07 +0800
commit698af68ed657b3287e23ce1d28b324a02f6914ff (patch)
tree71097a35bc0fe7cd3d35d9064b97ab8cc710e208
parentdf23dc663b19855ce29d90ac2281bba8de795d93 (diff)
downloadgo-698af68ed657b3287e23ce1d28b324a02f6914ff.tar.gz
os: remove document duplication in error predicate functions
R=golang-dev, r CC=golang-dev http://codereview.appspot.com/5783092
-rw-r--r--src/pkg/os/error.go18
-rw-r--r--src/pkg/os/error_plan9.go9
-rw-r--r--src/pkg/os/error_posix.go12
-rw-r--r--src/pkg/os/error_windows.go12
4 files changed, 27 insertions, 24 deletions
diff --git a/src/pkg/os/error.go b/src/pkg/os/error.go
index e0b83b5c2..54c2dc639 100644
--- a/src/pkg/os/error.go
+++ b/src/pkg/os/error.go
@@ -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)
+}
diff --git a/src/pkg/os/error_plan9.go b/src/pkg/os/error_plan9.go
index 159d685e7..3c9dfb0b1 100644
--- a/src/pkg/os/error_plan9.go
+++ b/src/pkg/os/error_plan9.go
@@ -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
}
diff --git a/src/pkg/os/error_posix.go b/src/pkg/os/error_posix.go
index d08ad5db1..1685c1f21 100644
--- a/src/pkg/os/error_posix.go
+++ b/src/pkg/os/error_posix.go
@@ -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
}
diff --git a/src/pkg/os/error_windows.go b/src/pkg/os/error_windows.go
index 84bf5eae8..b8b894b5a 100644
--- a/src/pkg/os/error_windows.go
+++ b/src/pkg/os/error_windows.go
@@ -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
}