Skip to content
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: SplitFunc documentation does not document ErrFinalToken #44261

Closed
JensRantil opened this issue Feb 14, 2021 · 4 comments
Closed

bufio: SplitFunc documentation does not document ErrFinalToken #44261

JensRantil opened this issue Feb 14, 2021 · 4 comments
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@JensRantil
Copy link

JensRantil commented Feb 14, 2021

What did you do?

I went to https://golang.org/pkg/bufio/#SplitFunc and read the documentation to implement a SplitFunc. In my implementation of a SplitFunc, for the case of atEOF, I simply returned len(data), data, nil thinking the Scanner would stop calling my function. It didn't (I was getting panic: bufio.Scan: too many empty tokens without progressing). I went back and looked at the "EmptyFinalToken" example here. It refered to ErrFinalToken which I was surprised to see since it wasn't mentioned in the SplitFunc documentation.

What did you expect to see?

I'd expect the SplitFunc documentation to include a reference to ErrFinalToken.

What did you see instead?

No reference to it at all.

@seankhliao seankhliao changed the title SplitFunc documentation does not document ErrFinalToken bufio: SplitFunc documentation does not document ErrFinalToken Feb 14, 2021
@ianlancetaylor ianlancetaylor added help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Feb 14, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Feb 14, 2021
@adesokanayo
Copy link

Suppose all that needs to be done here is to mention ErrFinalToken in the documentation for SplitFunc. I can do that if that is the case @ianlancetaylor

@ianlancetaylor
Copy link
Contributor

Yes, most likely one additional sentence would be appropriate in the docs for SplitFunc. Thanks.

@gopherbot
Copy link

Change https://golang.org/cl/293289 mentions this issue: bufio: update SplitFunc documentation by mentioning ErrFinalToken

nerdatmath added a commit to nerdatmath/go that referenced this issue Apr 29, 2021
A custom split function may return ErrFinalToken to trigger special processing. This is documented in the package documentation but not in that of SplitFunc itself. This short mention of it will hopefully reduce confusion.

Fixes golang#44261
@gopherbot
Copy link

Change https://golang.org/cl/314969 mentions this issue: bufio: mention ErrFinalToken in SplitFunc documentation

@golang golang locked and limited conversation to collaborators Apr 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
4 participants