diff options
author | joshuabezaleel <joshua.bezaleel@gmail.com> | 2020-02-07 17:36:26 +0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2020-06-04 10:53:46 +0000 |
commit | b371f189dfdfb2454a20ec276de55fe884d6ff9f (patch) | |
tree | 67ce2494bb5895afef1db412d9696553b12b3501 /src/io | |
parent | bffb8818e76e830697e183219523aa25a32480f0 (diff) | |
download | go-b371f189dfdfb2454a20ec276de55fe884d6ff9f.tar.gz go-b371f189dfdfb2454a20ec276de55fe884d6ff9f.zip |
io/ioutil: update WriteFile to clarify it does not change permissions if the file exists.
The existing documentation of WriteFile does not make it clear for
non-native English speakers that it will not change the permissions if
the file already exists before.
Fixes #35711
Change-Id: If861c3e3700957fc9ac3d5313351c57d399d3f58
Reviewed-on: https://go-review.googlesource.com/c/go/+/218417
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/ioutil/ioutil.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/io/ioutil/ioutil.go b/src/io/ioutil/ioutil.go index b1cb841468..acc6ec3a40 100644 --- a/src/io/ioutil/ioutil.go +++ b/src/io/ioutil/ioutil.go @@ -75,7 +75,7 @@ func ReadFile(filename string) ([]byte, error) { // WriteFile writes data to a file named by filename. // If the file does not exist, WriteFile creates it with permissions perm -// (before umask); otherwise WriteFile truncates it before writing. +// (before umask); otherwise WriteFile truncates it before writing, without changing permissions. func WriteFile(filename string, data []byte, perm os.FileMode) error { f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm) if err != nil { |