os: document that OpenFile Create do not create file if directory do not exist #69836
Labels
Documentation
Issues describing a change to documentation.
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I do not know
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run the followeing two codes (
./bugDir
directory must do not exist):What did you expect to see?
The creation of the file
bugFile
, if the directory do not exist it should be created. This is my understanding of documentation described behavior (1,2), otherwise should be stated clearly in docs that the path must exist before file creation.Note that the use of the flag
O_CREATE
suggest that the file will be created eitherways:workarround: create the directory with
os.MkdirAll(dir, os.ModePerm)
What did you see instead?
Error:
The text was updated successfully, but these errors were encountered: