-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os: os.Create & os.OpenFile both not creating .json file #67677
Comments
I attempted to trace this back, but the furthest I got before giving up was openFileNolog() in file_unix.go. Not even sure this is correct though. |
Does the |
~/.foo exists. I am utilizing it for loading in a config.env file earlier in the process, which works fine. |
I reproduced this in a separate project, receiving the same error when attempting to save directly to the home directory as well (I also changed ~ to $HOME, which resulted in the same error). |
Conversion of The |
You need to expand |
Thank you for catching my mistake! I knew I was doing something silly. Closing. |
Go version
1.22.3
OS
Debian 12.0
Output of
go env
in your module/workspace:What did you do?
Attempted to use os.Create to create a JSON file.
Also attempted to use os.OpenFile directly with the os.O_CREATE flag.
Also attempted to use os.WriteFile, another wrapper for os.OpenFile.
What did you see happen?
I received the following error, and the file was not created.
2024/05/28 13:03:53 open ~/.foo/bar.json: no such file or directory
What did you expect to see?
Ideally, I would have expected to see no error and the file created.
The text was updated successfully, but these errors were encountered: