summaryrefslogtreecommitdiff
path: root/src/pkg/bufio/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/bufio/example_test.go')
-rw-r--r--src/pkg/bufio/example_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pkg/bufio/example_test.go b/src/pkg/bufio/example_test.go
index 08a39441e..3da914142 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)