Skip to content

Commit 0069abb

Browse files
committed
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
1 parent 5de3b97 commit 0069abb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/io/ioutil/ioutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ func ReadFile(filename string) ([]byte, error) {
7474
}
7575

7676
// WriteFile writes data to a file named by filename.
77-
// If the file does not exist, WriteFile creates it with permissions perm;
78-
// otherwise WriteFile truncates it before writing.
77+
// If the file does not exist, WriteFile creates it with permissions perm
78+
// (before umask); otherwise WriteFile truncates it before writing.
7979
func WriteFile(filename string, data []byte, perm os.FileMode) error {
8080
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
8181
if err != nil {

0 commit comments

Comments
 (0)