Skip to content

Commit 25c39e4

Browse files
pantonshireianlancetaylor
authored andcommitted
io/ioutil: fix example test for WriteFile to allow it to run in the playground
The example for WriteFile assumed the existence of a testdata/ directory, which is not present on the playground. The example now writes the file to the current working directory, rather than to testdata/. Fixes #32916 Change-Id: I577caac7e67ba9d9941b2dd19346ad5ff61e78d9 GitHub-Last-Rev: 40f14e0 GitHub-Pull-Request: #43757 Reviewed-on: https://go-review.googlesource.com/c/go/+/284452 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Trust: Bryan C. Mills <[email protected]>
1 parent eb21b31 commit 25c39e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/io/ioutil/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func ExampleReadFile() {
125125

126126
func ExampleWriteFile() {
127127
message := []byte("Hello, Gophers!")
128-
err := ioutil.WriteFile("testdata/hello", message, 0644)
128+
err := ioutil.WriteFile("hello", message, 0644)
129129
if err != nil {
130130
log.Fatal(err)
131131
}

0 commit comments

Comments
 (0)