From 64b6421503dfb9396e46f94f9805ff7f8bf2b31b Mon Sep 17 00:00:00 2001 From: Matt Harden Date: Wed, 28 Apr 2021 19:55:04 -0700 Subject: [PATCH] Mentions ErrFinalToken in SplitFunc documentation 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 --- src/bufio/scan.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bufio/scan.go b/src/bufio/scan.go index af46a14fbb..4846d4f733 100644 --- a/src/bufio/scan.go +++ b/src/bufio/scan.go @@ -48,7 +48,8 @@ type Scanner struct { // and the next token to return to the user, if any, plus an error, if any. // // Scanning stops if the function returns an error, in which case some of -// the input may be discarded. +// the input may be discarded. If that error is ErrFinalToken, scanning +// stops with no error. // // Otherwise, the Scanner advances the input. If the token is not nil, // the Scanner returns it to the user. If the token is nil, the