diff options
| author | Shenghou Ma <minux.ma@gmail.com> | 2013-12-09 23:25:13 -0500 |
|---|---|---|
| committer | Shenghou Ma <minux.ma@gmail.com> | 2013-12-09 23:25:13 -0500 |
| commit | aa0ae7554c460947ff40ae43eb10a098dc4e3f6d (patch) | |
| tree | 86905595afe18ed17860027d89ac853461b42c66 /src/pkg/os | |
| parent | 46d1461ab75d67844ed4292cb7324a23f3a8496a (diff) | |
| download | go-aa0ae7554c460947ff40ae43eb10a098dc4e3f6d.tar.xz | |
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
Diffstat (limited to 'src/pkg/os')
| -rw-r--r-- | src/pkg/os/file.go | 3 | ||||
| -rw-r--r-- | src/pkg/os/file_plan9.go | 3 | ||||
| -rw-r--r-- | src/pkg/os/file_posix.go | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/os/file.go b/src/pkg/os/file.go index 2dd1fcf282..18cd61d3a8 100644 --- a/src/pkg/os/file.go +++ b/src/pkg/os/file.go @@ -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) diff --git a/src/pkg/os/file_plan9.go b/src/pkg/os/file_plan9.go index 708163ee1c..278fae772c 100644 --- a/src/pkg/os/file_plan9.go +++ b/src/pkg/os/file_plan9.go @@ -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() diff --git a/src/pkg/os/file_posix.go b/src/pkg/os/file_posix.go index a8bef359b9..90838682b6 100644 --- a/src/pkg/os/file_posix.go +++ b/src/pkg/os/file_posix.go @@ -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} |
