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