io/ioutil: docs for WriteFile should make it clear that it does not change permissions #35711
Labels
Documentation
Issues describing a change to documentation.
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Say you had
some-extant-file
with mode 0644 and you run:What did you expect to see?
From a cursory glance of the documentation you would expect that the mode of
some-extant-file
would change to 0777.What did you see instead?
It doesn't change mode - as is implied by the documentation saying it "truncates the file"
I think the documentation for
ioutil.WriteFile
should be clearer that when the file is already extant its mode will not change. This is implied by the current documentation, but it is subtle and a quick review of the docs will lead to and has led to developers & reviewers missing this important note causing bugs.The text was updated successfully, but these errors were encountered: