]> Cypherpunks repositories - gostls13.git/commitdiff
bufio.Scanner: delete obsolete TODO
authorRob Pike <r@golang.org>
Thu, 21 Mar 2013 21:56:42 +0000 (14:56 -0700)
committerRob Pike <r@golang.org>
Thu, 21 Mar 2013 21:56:42 +0000 (14:56 -0700)
Also fix the examples to use stderr for errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7716052

src/pkg/bufio/example_test.go
src/pkg/bufio/scan.go

index b545ce39aeef1d82806a02cf2d83609f4d98902e..08a39441e665adabd7897a66934279c86cac0220 100644 (file)
@@ -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
index b3c652911cfc91cc365190cef32ba25d4fe9144d..d94f7f9adc177856f0a88576214cd4ea72d7aea0 100644 (file)
@@ -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.