New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bufio: Scanner and empty final token #8672
Labels
Milestone
Comments
Labels changed: added release-go1.4, repo-main. Owner changed to @robpike. Status changed to Accepted. |
I tried this fix with no regression: diff -r 87b93aeb1822 src/pkg/bufio/scan.go --- a/src/pkg/bufio/scan.go Fri Sep 05 15:01:09 2014 -0700 +++ b/src/pkg/bufio/scan.go Mon Sep 08 19:15:24 2014 +0200 @@ -112,7 +112,7 @@ // Loop until we have a token. for { // See if we can get a token with what we already have. - if s.end > s.start { + if s.end > s.start || s.err != nil { advance, token, err := s.split(s.buf[s.start:s.end], s.err != nil) if err != nil { s.setErr(err) The SplitFunc's contract "The function is never called with an empty data slice unless atEOF is true" is respected. But the probability of regression with external implementations seems high. A complete patch (with a unit test) is attached (scan.patch). Regards. Attachments:
|
CL https://golang.org/cl/145390043 mentions this issue. |
This issue was closed by revision 74c0de8. Status changed to Fixed. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
Fixes golang#8672. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145390043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 26, 2018
Fixes golang#8672. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145390043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
Fixes golang#8672. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145390043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 30, 2018
Fixes golang#8672. LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/145390043
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: