Commit a5f21c95 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

os: document the type of link errors

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673090
parent 85f2d18a
...@@ -276,7 +276,6 @@ func Remove(name string) error { ...@@ -276,7 +276,6 @@ func Remove(name string) error {
} }
// Rename renames a file. // Rename renames a file.
// If there is an error, it will be of type *PathError.
func Rename(oldname, newname string) error { func Rename(oldname, newname string) error {
var d Dir var d Dir
d.Null() d.Null()
...@@ -340,12 +339,15 @@ func Pipe() (r *File, w *File, err error) { ...@@ -340,12 +339,15 @@ func Pipe() (r *File, w *File, err error) {
// not supported on Plan 9 // not supported on Plan 9
// Link creates a hard link. // Link creates a hard link.
// If there is an error, it will be of type *LinkError.
func Link(oldname, newname string) error { 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 { func Symlink(oldname, newname string) error {
return ErrPlan9 return &LinkError{"symlink", oldname, newname, ErrPlan9}
} }
func Readlink(name string) (string, error) { func Readlink(name string) (string, error) {
......
...@@ -38,6 +38,7 @@ func (e *LinkError) Error() string { ...@@ -38,6 +38,7 @@ func (e *LinkError) Error() string {
} }
// Link creates newname as a hard link to the oldname file. // 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 { func Link(oldname, newname string) error {
e := syscall.Link(oldname, newname) e := syscall.Link(oldname, newname)
if e != nil { if e != nil {
...@@ -47,6 +48,7 @@ func Link(oldname, newname string) error { ...@@ -47,6 +48,7 @@ func Link(oldname, newname string) error {
} }
// Symlink creates newname as a symbolic link to oldname. // 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 { func Symlink(oldname, newname string) error {
e := syscall.Symlink(oldname, newname) e := syscall.Symlink(oldname, newname)
if e != nil { if e != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment