Commit 5126fead authored by Agniva De Sarker's avatar Agniva De Sarker Committed by Agniva De Sarker

bufio: fix emptyFinalToken example to handle multiple Reads

Fixes #25909

Change-Id: I9a53a1a06aab5d1877a8e9b1b8b782d77d6027a8
Reviewed-on: https://go-review.googlesource.com/c/157758Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5edb175b
......@@ -94,6 +94,9 @@ func ExampleScanner_emptyFinalToken() {
return i + 1, data[:i], nil
}
}
if !atEOF {
return 0, nil, nil
}
// There is one final token to be delivered, which may be the empty string.
// Returning bufio.ErrFinalToken here tells Scan there are no more tokens after this
// but does not trigger an error to be returned from Scan itself.
......
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