From b83429b5b595598a3c3a2b17ca518127fcdbb670 Mon Sep 17 00:00:00 2001 From: Yury Frolov <57130330+EinKrebs@users.noreply.github.com> Date: Tue, 5 Oct 2021 10:51:43 +0500 Subject: [PATCH] Moved scanner.eof() call to proper place (#9) --- reader.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reader.go b/reader.go index 5ba5457..0a3198e 100644 --- a/reader.go +++ b/reader.go @@ -43,14 +43,12 @@ func (s *streamReader) Load(i int) error { } } s.buf.Write(buf[:n]) - if n < neededLen { + if err == io.EOF { + s.finished = true if code := s.scanner.eof(); code == scanError { return s.scanner.err } } - if err == io.EOF { - s.finished = true - } return err }