diff options
author | G. Hussain Chinoy <ghchinoy@gmail.com> | 2018-08-30 18:24:53 +0000 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2018-08-30 18:38:34 +0000 |
commit | f882d89b768bcfbd02b209acf0d525f4dbdd8f09 (patch) | |
tree | 25c7ab17d97590200e3cfc4b5b99ce2c311d0578 /src/io | |
parent | 360771e422ff0e586963e1dc0818c427b5444379 (diff) | |
download | go-f882d89b768bcfbd02b209acf0d525f4dbdd8f09.tar.gz go-f882d89b768bcfbd02b209acf0d525f4dbdd8f09.zip |
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>
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/ioutil/example_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/io/ioutil/example_test.go b/src/io/ioutil/example_test.go index 0b24f672ee..a7d340b77f 100644 --- a/src/io/ioutil/example_test.go +++ b/src/io/ioutil/example_test.go @@ -99,3 +99,11 @@ func ExampleReadFile() { // Output: // File contents: Hello, Gophers! } + +func ExampleWriteFile() { + message := []byte("Hello, Gophers!") + err := ioutil.WriteFile("testdata/hello", message, 0644) + if err != nil { + log.Fatal(err) + } +} |