aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/os
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2013-12-09 23:25:13 -0500
committerShenghou Ma <minux.ma@gmail.com>2013-12-09 23:25:13 -0500
commitaa0ae7554c460947ff40ae43eb10a098dc4e3f6d (patch)
tree86905595afe18ed17860027d89ac853461b42c66 /src/pkg/os
parent46d1461ab75d67844ed4292cb7324a23f3a8496a (diff)
downloadgo-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.go3
-rw-r--r--src/pkg/os/file_plan9.go3
-rw-r--r--src/pkg/os/file_posix.go3
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}