You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wrapped io.EOF was returned from scanner.Err().
I would expect the check to use errors.Is(s.err, io.EOF):
// Err returns the first non-EOF error that was encountered by the Scanner.func (s*Scanner) Err() error {
iferrors.Is(s.err, io.EOF) {
returnnil
}
returns.err
}
Thanks, but as is documented at https://pkg.go.dev/io#Reader, a Read method should return io.EOF at end-of-file. It should not return an error that wraps io.EOF.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Scanned from a reader which returned a wrapped io.EOF.
https://go.dev/play/p/HClzqB8deSR
What did you expect to see?
No errors.
What did you see instead?
The wrapped io.EOF was returned from scanner.Err().
I would expect the check to use
errors.Is(s.err, io.EOF)
:And not the direct check:
The text was updated successfully, but these errors were encountered: