diff options
Diffstat (limited to 'libgo/go/bufio/example_test.go')
-rw-r--r-- | libgo/go/bufio/example_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libgo/go/bufio/example_test.go b/libgo/go/bufio/example_test.go index 08a39441e66..3da91414219 100644 --- a/libgo/go/bufio/example_test.go +++ b/libgo/go/bufio/example_test.go @@ -12,6 +12,14 @@ import ( "strings" ) +func ExampleWriter() { + w := bufio.NewWriter(os.Stdout) + fmt.Fprint(w, "Hello, ") + fmt.Fprint(w, "world!") + w.Flush() // Don't forget to flush! + // Output: Hello, world! +} + // The simplest use of a Scanner, to read standard input as a set of lines. func ExampleScanner_lines() { scanner := bufio.NewScanner(os.Stdin) |