Closed
Description
What version of Go are you using (go version
)?
latest
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
Go Playground https://play.golang.org/
What did you do?
run example at https://golang.org/pkg/io/ioutil/#WriteFile which links to https://play.golang.org/p/bIP2HMSXz1u
What did you expect to see?
no error
What did you see instead?
error: `open testdata/hello: no such file or directory
Suggested Fixes
WriteFile
does not create a directory, and the code example tries to write to the non-existent directory testdata
. Possible solution are either to create this directory in the example code or change the argument to WriteFile
to just include the file name