From: G. Hussain Chinoy Date: Thu, 30 Aug 2018 18:24:53 +0000 (+0000) Subject: ghchinoy: add example for ioutil.WriteFile X-Git-Tag: go1.12beta1~1217 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f882d89b768bcfbd02b209acf0d525f4dbdd8f09;p=gostls13.git ghchinoy: add example for ioutil.WriteFile Change-Id: I65c3bda498562fdf39994ec1cadce7947e2d84b5 Reviewed-on: https://go-review.googlesource.com/132277 Run-TryBot: Bryan C. Mills TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills --- 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) + } +}