diff options
author | Pantonshire <tom@tomandtally.co.uk> | 2021-01-18 17:41:36 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-01-22 23:03:58 +0000 |
commit | 25c39e4fb5e5fc7c3840228158cd6f2345c9dc07 (patch) | |
tree | f856ef62f1431e0105d28a2658d7dda46cd12ed5 | |
parent | eb21b31e487344fb0045b3ef7b14df9521b94952 (diff) | |
download | go-25c39e4fb5e5fc7c3840228158cd6f2345c9dc07.tar.gz go-25c39e4fb5e5fc7c3840228158cd6f2345c9dc07.zip |
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: 40f14e0adc4ebc00fb2946fe0cbaf8e0cb99f62c
GitHub-Pull-Request: golang/go#43757
Reviewed-on: https://go-review.googlesource.com/c/go/+/284452
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
-rw-r--r-- | src/io/ioutil/example_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/io/ioutil/example_test.go b/src/io/ioutil/example_test.go index bc2b6fba73..78b0730c65 100644 --- a/src/io/ioutil/example_test.go +++ b/src/io/ioutil/example_test.go @@ -125,7 +125,7 @@ func ExampleReadFile() { func ExampleWriteFile() { message := []byte("Hello, Gophers!") - err := ioutil.WriteFile("testdata/hello", message, 0644) + err := ioutil.WriteFile("hello", message, 0644) if err != nil { log.Fatal(err) } |