From: Andrew Gerrand Date: Mon, 12 Aug 2013 03:03:50 +0000 (+1000) Subject: bufio: add Writer example X-Git-Tag: go1.2rc2~661 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8eb8ad245416f29c7f9848de288a0ece325d531b;p=gostls13.git bufio: add Writer example Update #5530 R=golang-dev, r CC=golang-dev https://golang.org/cl/12504044 --- diff --git a/src/pkg/bufio/example_test.go b/src/pkg/bufio/example_test.go index 08a39441e6..3da9141421 100644 --- a/src/pkg/bufio/example_test.go +++ b/src/pkg/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)