diff --git a/src/os/file.go b/src/os/file.go index e8d2de1b3cb5cf..57056df33eee8b 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -730,6 +730,8 @@ func ReadFile(name string) ([]byte, error) { // WriteFile writes data to the named file, creating it if necessary. // If the file does not exist, WriteFile creates it with permissions perm (before umask); // otherwise WriteFile truncates it before writing, without changing permissions. +// Since Writefile requires multiple system calls to complete, a failure mid-operation +// can leave the file in a partially written state. func WriteFile(name string, data []byte, perm FileMode) error { f, err := OpenFile(name, O_WRONLY|O_CREATE|O_TRUNC, perm) if err != nil {