commit | f882d89b768bcfbd02b209acf0d525f4dbdd8f09 | [log] [tgz] |
---|---|---|
author | G. Hussain Chinoy <ghchinoy@gmail.com> | Thu Aug 30 18:24:53 2018 +0000 |
committer | Bryan C. Mills <bcmills@google.com> | Thu Aug 30 18:38:34 2018 +0000 |
tree | 25c7ab17d97590200e3cfc4b5b99ce2c311d0578 | |
parent | 360771e422ff0e586963e1dc0818c427b5444379 [diff] |
ghchinoy: add example for ioutil.WriteFile Change-Id: I65c3bda498562fdf39994ec1cadce7947e2d84b5 Reviewed-on: https://go-review.googlesource.com/132277 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
diff --git a/src/io/ioutil/example_test.go b/src/io/ioutil/example_test.go index 0b24f67..a7d340b 100644 --- a/src/io/ioutil/example_test.go +++ b/src/io/ioutil/example_test.go
@@ -99,3 +99,11 @@ // Output: // File contents: Hello, Gophers! } + +func ExampleWriteFile() { + message := []byte("Hello, Gophers!") + err := ioutil.WriteFile("testdata/hello", message, 0644) + if err != nil { + log.Fatal(err) + } +}