Skip to content

Commit

Permalink
os: clarify docs for Rename.
Browse files Browse the repository at this point in the history
Three changes:
1. mention "move" to clarify things up.
2. use {old,new}path instead of {old,new}name, which makes it clear what
   relative path would do here.
3. mention "OS-specific restrictions might apply".

Fixes #6887.

R=golang-dev, alex.brainman, iant, r
CC=golang-dev
https://golang.org/cl/36930044
  • Loading branch information
minux committed Dec 10, 2013
1 parent 46d1461 commit aa0ae75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/pkg/os/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func (f *File) Write(b []byte) (n int, err error) {
if n < 0 {
n = 0
}
if n != len(b) {
err = io.ErrShortWrite
}

epipecheck(f, e)

Expand Down
3 changes: 1 addition & 2 deletions src/pkg/os/file_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ func Remove(name string) error {
return nil
}

// Rename renames a file.
func Rename(oldname, newname string) error {
func rename(oldname, newname string) error {
var d syscall.Dir

d.Null()
Expand Down
3 changes: 1 addition & 2 deletions src/pkg/os/file_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,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 e != nil {
return &LinkError{"rename", oldname, newname, e}
Expand Down

0 comments on commit aa0ae75

Please sign in to comment.