From: Russ Cox Date: Wed, 6 Jan 2016 19:43:16 +0000 (-0500) Subject: os: document that Rename overwrites existing file X-Git-Tag: go1.6beta2~105 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5d8442aeaaa852486b39049f6d4c3d79c87be011;p=gostls13.git os: document that Rename overwrites existing file Fixes #13673. Change-Id: I60d1603ca0dfd2ae136117e0f89cee4b6fc6c3d3 Reviewed-on: https://go-review.googlesource.com/18332 Reviewed-by: Ian Lance Taylor --- diff --git a/src/os/file.go b/src/os/file.go index 6acc57a918..4f8e3f3450 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -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)