Skip to content

Commit 20d229f

Browse files
authored
Update file.go
Update wording with that suggested by Rob Pike
1 parent 25367d9 commit 20d229f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/os/file.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,8 @@ func ReadFile(name string) ([]byte, error) {
730730
// WriteFile writes data to the named file, creating it if necessary.
731731
// If the file does not exist, WriteFile creates it with permissions perm (before umask);
732732
// otherwise WriteFile truncates it before writing, without changing permissions.
733-
// Note that WriteFile is not atomic and can have side effects.
733+
// Since Writefile requires multiple system calls to complete, a failure mid-operation
734+
// can leave the file in a partially written state.
734735
func WriteFile(name string, data []byte, perm FileMode) error {
735736
f, err := OpenFile(name, O_WRONLY|O_CREATE|O_TRUNC, perm)
736737
if err != nil {

0 commit comments

Comments
 (0)