Commit 42aec4c0 authored by Vitor De Mario's avatar Vitor De Mario Committed by Brad Fitzpatrick

io/ioutil: add example for ReadFile

Change-Id: I062ec0606a741c8aa1b74f3f4b4e4fd47f76fed5
Reviewed-on: https://go-review.googlesource.com/48775Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent ced46c62
......@@ -69,3 +69,15 @@ func ExampleTempFile() {
log.Fatal(err)
}
}
func ExampleReadFile() {
content, err := ioutil.ReadFile("testdata/hello")
if err != nil {
log.Fatal(err)
}
fmt.Printf("File contents: %s", content)
// Output:
// File contents: Hello, Gophers!
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment