]> Cypherpunks repositories - gostls13.git/commitdiff
os: rename SyscallError.Errno to SyscallError.Err
authorAnthony Martin <ality@pbrane.org>
Tue, 14 Feb 2012 19:22:34 +0000 (14:22 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 14 Feb 2012 19:22:34 +0000 (14:22 -0500)
This lets us get rid of the OS-dependent implementations
of SyscallError.  The name "Err" was chosen to match the
PathError type.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5651084

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

index c3dd06feb7b9c61cb214402c7789e46c72563750..135cdae1f9b74e506bb39f140ead4eddd43ded85 100644 (file)
@@ -12,3 +12,21 @@ type PathError struct {
 }
 
 func (e *PathError) Error() string { return e.Op + " " + e.Path + ": " + e.Err.Error() }
+
+// SyscallError records an error from a specific system call.
+type SyscallError struct {
+       Syscall string
+       Err     error
+}
+
+func (e *SyscallError) Error() string { return e.Syscall + ": " + e.Err.Error() }
+
+// NewSyscallError returns, as an error, a new SyscallError
+// with the given system call name and error details.
+// As a convenience, if err is nil, NewSyscallError returns nil.
+func NewSyscallError(syscall string, err error) error {
+       if err == nil {
+               return nil
+       }
+       return &SyscallError{syscall, err}
+}
index 3c727b2ab39e44d0151e1612efd9ee7e51d5f732..cc847e0774324939756425bb5361d2a9529a7114 100644 (file)
@@ -9,24 +9,6 @@ import (
        "syscall"
 )
 
-// SyscallError records an error from a specific system call.
-type SyscallError struct {
-       Syscall string
-       Err     string
-}
-
-func (e *SyscallError) Error() string { return e.Syscall + ": " + e.Err }
-
-// NewSyscallError returns, as an error, a new SyscallError
-// with the given system call name and error details.
-// As a convenience, if err is nil, NewSyscallError returns nil.
-func NewSyscallError(syscall string, err error) error {
-       if err == nil {
-               return nil
-       }
-       return &SyscallError{syscall, err.Error()}
-}
-
 var (
        Eshortstat = errors.New("stat buffer too small")
        Ebadstat   = errors.New("malformed stat buffer")
index 7fdf3e10f07332299c404e9db32e86b0f8bf9a96..57c9b6f27862c374a7fa91ceee3bb5a5aafe8108 100644 (file)
@@ -6,7 +6,7 @@
 
 package os
 
-import syscall "syscall"
+import "syscall"
 
 // Commonly known Unix errors.
 var (
@@ -49,21 +49,3 @@ var (
        ETIMEDOUT    error = syscall.ETIMEDOUT
        ENOTCONN     error = syscall.ENOTCONN
 )
-
-// SyscallError records an error from a specific system call.
-type SyscallError struct {
-       Syscall string
-       Errno   error
-}
-
-func (e *SyscallError) Error() string { return e.Syscall + ": " + e.Errno.Error() }
-
-// NewSyscallError returns, as an error, a new SyscallError
-// with the given system call name and error details.
-// As a convenience, if err is nil, NewSyscallError returns nil.
-func NewSyscallError(syscall string, err error) error {
-       if err == nil {
-               return nil
-       }
-       return &SyscallError{syscall, err}
-}