-
Notifications
You must be signed in to change notification settings - Fork 18k
io/ioutil: WriteFile example returns "No such file or directory" because testdata does not exist #32916
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
Comments
EDIT: Sorry was looking at the wrong example |
Indeed, that link https://golang.org/pkg/io/ioutil/#WriteFile above, which offers much better |
Thanks. The code in the example assumes a You are welcome to send a patch. |
https://github.com/golang/go/tree/master/src/io/ioutil/testdata Isn't it still present? |
@darkLord19 Examples are run in separate environment, without the directory structure as in source code. |
Change https://golang.org/cl/185037 mentions this issue: |
Regarding https://golang.org/cl/185037 :
|
I believe this is a specific case of the broader issue #19825. |
Does the fix need to bring the |
tryCreateUdevRule creates a udev file by using WriteFile WriteFile will not create the directory hierarchy in case it doesn't exist [1]. Therefore create the folder in case it doesn't exist. [1] golang/go#32916 Related to k8snetworkplumbingwg#10 Signed-off-by: Or Shoval <[email protected]>
tryCreateUdevRule creates a udev file by using WriteFile WriteFile will not create the directory hierarchy in case it doesn't exist [1]. Therefore create the folder in case it doesn't exist. [1] golang/go#32916 Related to k8snetworkplumbingwg#10 Signed-off-by: Or Shoval <[email protected]>
Change https://golang.org/cl/284452 mentions this issue: |
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?
Run example in https://golang.org/pkg/io/ioutil/#WriteFile
What did you expect to see?
Expected file created
What did you see instead?
2009/11/10 23:00:00 open testdata/hello: No such file or directory
Program exited.
The text was updated successfully, but these errors were encountered: