1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:24:40 -07:00

os: document the type of link errors

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5673090
This commit is contained in:
Brad Fitzpatrick 2012-02-18 04:45:43 -08:00
parent 85f2d18a72
commit a5f21c95dc
2 changed files with 7 additions and 3 deletions

View 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) {

View 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 {