Commit 5bbdf405 authored by Rob Pike's avatar Rob Pike

bufio.Scanner: delete obsolete TODO

Also fix the examples to use stderr for errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7716052
parent d7c1f67c
......@@ -19,7 +19,7 @@ func ExampleScanner_lines() {
fmt.Println(scanner.Text()) // Println will add back the final '\n'
}
if err := scanner.Err(); err != nil {
fmt.Fprintln(os.Stdout, "reading standard input:", err)
fmt.Fprintln(os.Stderr, "reading standard input:", err)
}
}
......@@ -37,7 +37,7 @@ func ExampleScanner_words() {
count++
}
if err := scanner.Err(); err != nil {
fmt.Fprintln(os.Stdout, "reading input:", err)
fmt.Fprintln(os.Stderr, "reading input:", err)
}
fmt.Printf("%d\n", count)
// Output: 15
......
......@@ -27,8 +27,6 @@ import (
// control over error handling or large tokens, or must run sequential scans
// on a reader, should use bufio.Reader instead.
//
// TODO(r): Provide executable examples.
//
type Scanner struct {
r io.Reader // The reader provided by the client.
split SplitFunc // The function to split the tokens.
......
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