For #61422.
Change-Id: I1b20c536a5b1c105286c84e7c1c7e37eb89bbc93
Reviewed-on: https://go-review.googlesource.com/c/go/+/548879
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
<dd>
- <p><!-- https://go.dev/issue/56381 -->
- TODO: <a href="https://go.dev/issue/56381">https://go.dev/issue/56381</a>: allow terminating Scanner early cleanly without a final token or an error
+ <p><!-- https://go.dev/issue/56381, CL 498117 -->
+ When a <a href="/pkg/bufio#SplitFunc"><code>SplitFunc</code></a> returns <a href="/pkg/bufio#ErrFinalToken"><code>ErrFinalToken</code></a> with a <code>nil</code> token, <a href="/pkg/bufio#Scanner"><code>Scanner</code></a> will now stop immediately.
+ Previously, it would report a final empty token before stopping, which was usually not desired.
+ Callers that do want to report a final empty token can do so by returning <code>[]byte{}</code> rather than <code>nil</code>.
</p>
</dd>
</dl><!-- bufio -->