aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorMostyn Bramley-Moore <mostyn@antipode.se>2019-11-27 00:10:47 +0000
committerIan Lance Taylor <iant@golang.org>2019-11-27 02:18:51 +0000
commit95c9a656ae2e690c82ca339605a79f88f407fa9b (patch)
tree2b61e909118221ce2c7d80bf8da4a3e5433d8549 /src/io
parent0f251028585e052a3d34dcce83b05d8aa9ba170e (diff)
downloadgo-95c9a656ae2e690c82ca339605a79f88f407fa9b.tar.gz
go-95c9a656ae2e690c82ca339605a79f88f407fa9b.zip
doc: clarify interaction of ioutil.WriteFile with umask
Note that ioutil.WriteFile's perm argument is the value before the umask is applied. Fixes #35835 Change-Id: I61cd9c88bced3be52b616d86e060cd3fd912ab1f Change-Id: I61cd9c88bced3be52b616d86e060cd3fd912ab1f GitHub-Last-Rev: 0069abb7c5d904fb11448148f44db023dbcf74aa GitHub-Pull-Request: golang/go#35836 Reviewed-on: https://go-review.googlesource.com/c/go/+/208838 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/ioutil/ioutil.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/io/ioutil/ioutil.go b/src/io/ioutil/ioutil.go
index e617be5dae..b1cb841468 100644
--- a/src/io/ioutil/ioutil.go
+++ b/src/io/ioutil/ioutil.go
@@ -74,8 +74,8 @@ 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;
-// otherwise WriteFile truncates it before writing.
+// If the file does not exist, WriteFile creates it with permissions perm
+// (before umask); otherwise WriteFile truncates it before writing.
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 {