1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:54:55 -07:00

os: document that Rename does not replace an existing directory

Fixes #18240.

Change-Id: Ife951e2c1320b3f1362c85642615b24fd4291189
Reviewed-on: https://go-review.googlesource.com/34135
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-12-07 17:13:35 -08:00
parent f28eea89e0
commit d4b46aa1b8

View File

@ -260,7 +260,7 @@ func Create(name string) (*File, error) {
var lstat = Lstat var lstat = Lstat
// Rename renames (moves) oldpath to newpath. // Rename renames (moves) oldpath to newpath.
// If newpath already exists, Rename replaces it. // If newpath already exists and is not a directory, Rename replaces it.
// OS-specific restrictions may apply when oldpath and newpath are in different directories. // OS-specific restrictions may apply when oldpath and newpath are in different directories.
// If there is an error, it will be of type *LinkError. // If there is an error, it will be of type *LinkError.
func Rename(oldpath, newpath string) error { func Rename(oldpath, newpath string) error {