1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:30:25 -07:00

os: clarify docs for Rename.

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
This commit is contained in:
Shenghou Ma 2013-12-09 23:25:13 -05:00
parent 46d1461ab7
commit aa0ae7554c
3 changed files with 5 additions and 4 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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}