mirror of https://github.com/golang/go.git
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:
parent
360771e422
commit
f882d89b76
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue