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>
This commit is contained in:
G. Hussain Chinoy 2018-08-30 18:24:53 +00:00 committed by Bryan C. Mills
parent 360771e422
commit f882d89b76
1 changed files with 8 additions and 0 deletions

View File

@ -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)
}
}