]> Cypherpunks repositories - gostls13.git/commitdiff
os: document the type of link errors
authorBrad Fitzpatrick <bradfitz@golang.org>
Sat, 18 Feb 2012 12:45:43 +0000 (04:45 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 18 Feb 2012 12:45:43 +0000 (04:45 -0800)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673090

src/pkg/os/file_plan9.go
src/pkg/os/file_posix.go

index 70041f22aa895344ccc5ec7f98fdec29e1e1fe05..cb0e9ef9289871690388086c6f328fdbb3e21216 100644 (file)
@@ -276,7 +276,6 @@ func Remove(name string) error {
 }
 
 // Rename renames a file.
-// If there is an error, it will be of type *PathError.
 func Rename(oldname, newname string) error {
        var d Dir
        d.Null()
@@ -340,12 +339,15 @@ func Pipe() (r *File, w *File, err error) {
 // not supported on Plan 9
 
 // Link creates a hard link.
+// If there is an error, it will be of type *LinkError.
 func Link(oldname, newname string) error {
-       return ErrPlan9
+       return &LinkError{"link", oldname, newname, ErrPlan9}
 }
 
+// Symlink creates newname as a symbolic link to oldname.
+// If there is an error, it will be of type *LinkError.
 func Symlink(oldname, newname string) error {
-       return ErrPlan9
+       return &LinkError{"symlink", oldname, newname, ErrPlan9}
 }
 
 func Readlink(name string) (string, error) {
index 8861af1c7d4f4e3647cd0ec0844cf0e937e250f6..2ffc2ee083983a261457abe68bcb2c4aa7faecc1 100644 (file)
@@ -38,6 +38,7 @@ func (e *LinkError) Error() string {
 }
 
 // Link creates newname as a hard link to the oldname file.
+// If there is an error, it will be of type *LinkError.
 func Link(oldname, newname string) error {
        e := syscall.Link(oldname, newname)
        if e != nil {
@@ -47,6 +48,7 @@ func Link(oldname, newname string) error {
 }
 
 // Symlink creates newname as a symbolic link to oldname.
+// If there is an error, it will be of type *LinkError.
 func Symlink(oldname, newname string) error {
        e := syscall.Symlink(oldname, newname)
        if e != nil {