Skip to content

Commit

Permalink
os: document that Rename overwrites existing file
Browse files Browse the repository at this point in the history
Fixes golang#13673.

Change-Id: I60d1603ca0dfd2ae136117e0f89cee4b6fc6c3d3
Reviewed-on: https://go-review.googlesource.com/18332
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
rsc committed Jan 7, 2016
1 parent dba926d commit 5d8442a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/os/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ func Create(name string) (*File, error) {
// lstat is overridden in tests.
var lstat = Lstat

// Rename renames (moves) a file. OS-specific restrictions might apply.
// Rename renames (moves) oldpath to newpath.
// If newpath already exists, Rename replaces it.
// OS-specific restrictions may apply when oldpath and newpath are in different directories.
// If there is an error, it will be of type *LinkError.
func Rename(oldpath, newpath string) error {
return rename(oldpath, newpath)
Expand Down

0 comments on commit 5d8442a

Please sign in to comment.