diff --git a/src/os/file.go b/src/os/file.go index fdead63bfc4..8c25cc0a3b5 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -265,10 +265,10 @@ func Open(name string) (*File, error) { return OpenFile(name, O_RDONLY, 0) } -// Create creates the named file with mode 0666 (before umask), truncating -// it if it already exists. If successful, methods on the returned -// File can be used for I/O; the associated file descriptor has mode -// O_RDWR. +// Create creates or truncates the named file. If the file already exists, +// it is truncated. If the file does not exist, it is created with mode 0666 +// (before umask). If successful, methods on the returned File can +// be used for I/O; the associated file descriptor has mode O_RDWR. // If there is an error, it will be of type *PathError. func Create(name string) (*File, error) { return OpenFile(name, O_RDWR|O_CREATE|O_TRUNC, 0666) @@ -276,7 +276,8 @@ func Create(name string) (*File, error) { // OpenFile is the generalized open call; most users will use Open // or Create instead. It opens the named file with specified flag -// (O_RDONLY etc.) and perm (before umask), if applicable. If successful, +// (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag +// is passed, it is created with mode perm (before umask). If successful, // methods on the returned File can be used for I/O. // If there is an error, it will be of type *PathError. func OpenFile(name string, flag int, perm FileMode) (*File, error) {