diff options
Diffstat (limited to 'libgo/go/os/file_posix.go')
| -rw-r--r-- | libgo/go/os/file_posix.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/libgo/go/os/file_posix.go b/libgo/go/os/file_posix.go index 5269149565b..c937b6d6266 100644 --- a/libgo/go/os/file_posix.go +++ b/libgo/go/os/file_posix.go @@ -24,7 +24,7 @@ func epipecheck(file *File, e int) { } // Remove removes the named file or directory. -func Remove(name string) Error { +func Remove(name string) error { // System call interface forces us to know // whether name is a file or directory. // Try both: it is cheaper on average than @@ -59,18 +59,18 @@ func Remove(name string) Error { // LinkError records an error during a link or symlink or rename // system call and the paths that caused it. type LinkError struct { - Op string - Old string - New string - Error Error + Op string + Old string + New string + Err error } -func (e *LinkError) String() string { - return e.Op + " " + e.Old + " " + e.New + ": " + e.Error.String() +func (e *LinkError) Error() string { + return e.Op + " " + e.Old + " " + e.New + ": " + e.Err.Error() } // Link creates a hard link. -func Link(oldname, newname string) Error { +func Link(oldname, newname string) error { e := syscall.Link(oldname, newname) if iserror(e) { return &LinkError{"link", oldname, newname, Errno(e)} @@ -79,7 +79,7 @@ func Link(oldname, newname string) Error { } // Symlink creates a symbolic link. -func Symlink(oldname, newname string) Error { +func Symlink(oldname, newname string) error { e := syscall.Symlink(oldname, newname) if iserror(e) { return &LinkError{"symlink", oldname, newname, Errno(e)} @@ -88,8 +88,8 @@ func Symlink(oldname, newname string) Error { } // Readlink reads the contents of a symbolic link: the destination of -// the link. It returns the contents and an Error, if any. -func Readlink(name string) (string, Error) { +// the link. It returns the contents and an error, if any. +func Readlink(name string) (string, error) { for len := 128; ; len *= 2 { b := make([]byte, len) n, e := syscall.Readlink(name, b) @@ -105,7 +105,7 @@ func Readlink(name string) (string, Error) { } // Rename renames a file. -func Rename(oldname, newname string) Error { +func Rename(oldname, newname string) error { e := syscall.Rename(oldname, newname) if iserror(e) { return &LinkError{"rename", oldname, newname, Errno(e)} @@ -115,7 +115,7 @@ func Rename(oldname, newname string) Error { // Chmod changes the mode of the named file to mode. // If the file is a symbolic link, it changes the mode of the link's target. -func Chmod(name string, mode uint32) Error { +func Chmod(name string, mode uint32) error { if e := syscall.Chmod(name, mode); iserror(e) { return &PathError{"chmod", name, Errno(e)} } @@ -123,7 +123,7 @@ func Chmod(name string, mode uint32) Error { } // Chmod changes the mode of the file to mode. -func (f *File) Chmod(mode uint32) Error { +func (f *File) Chmod(mode uint32) error { if e := syscall.Fchmod(f.fd, mode); iserror(e) { return &PathError{"chmod", f.name, Errno(e)} } @@ -132,7 +132,7 @@ func (f *File) Chmod(mode uint32) Error { // Chown changes the numeric uid and gid of the named file. // If the file is a symbolic link, it changes the uid and gid of the link's target. -func Chown(name string, uid, gid int) Error { +func Chown(name string, uid, gid int) error { if e := syscall.Chown(name, uid, gid); iserror(e) { return &PathError{"chown", name, Errno(e)} } @@ -141,7 +141,7 @@ func Chown(name string, uid, gid int) Error { // Lchown changes the numeric uid and gid of the named file. // If the file is a symbolic link, it changes the uid and gid of the link itself. -func Lchown(name string, uid, gid int) Error { +func Lchown(name string, uid, gid int) error { if e := syscall.Lchown(name, uid, gid); iserror(e) { return &PathError{"lchown", name, Errno(e)} } @@ -149,7 +149,7 @@ func Lchown(name string, uid, gid int) Error { } // Chown changes the numeric uid and gid of the named file. -func (f *File) Chown(uid, gid int) Error { +func (f *File) Chown(uid, gid int) error { if e := syscall.Fchown(f.fd, uid, gid); iserror(e) { return &PathError{"chown", f.name, Errno(e)} } @@ -158,7 +158,7 @@ func (f *File) Chown(uid, gid int) Error { // Truncate changes the size of the file. // It does not change the I/O offset. -func (f *File) Truncate(size int64) Error { +func (f *File) Truncate(size int64) error { if e := syscall.Ftruncate(f.fd, size); iserror(e) { return &PathError{"truncate", f.name, Errno(e)} } @@ -168,7 +168,7 @@ func (f *File) Truncate(size int64) Error { // Sync commits the current contents of the file to stable storage. // Typically, this means flushing the file system's in-memory copy // of recently written data to disk. -func (file *File) Sync() (err Error) { +func (file *File) Sync() (err error) { if file == nil { return EINVAL } @@ -184,7 +184,7 @@ func (file *File) Sync() (err Error) { // The argument times are in nanoseconds, although the underlying // filesystem may truncate or round the values to a more // coarse time unit. -func Chtimes(name string, atime_ns int64, mtime_ns int64) Error { +func Chtimes(name string, atime_ns int64, mtime_ns int64) error { var utimes [2]syscall.Timeval utimes[0] = syscall.NsecToTimeval(atime_ns) utimes[1] = syscall.NsecToTimeval(mtime_ns) |
