From d074dea0fcf196a01ed5899489381347b55a765c Mon Sep 17 00:00:00 2001 From: Andy Bursavich Date: Wed, 8 Feb 2023 16:17:22 -0800 Subject: [PATCH] expfmt: only ignore io.EOF errors in TextParse.startOfLine Signed-off-by: Andy Bursavich --- expfmt/text_parse.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/expfmt/text_parse.go b/expfmt/text_parse.go index 84be0643..ac248278 100644 --- a/expfmt/text_parse.go +++ b/expfmt/text_parse.go @@ -142,9 +142,13 @@ func (p *TextParser) reset(in io.Reader) { func (p *TextParser) startOfLine() stateFn { p.lineCount++ if p.skipBlankTab(); p.err != nil { - // End of input reached. This is the only case where - // that is not an error but a signal that we are done. - p.err = nil + // This is the only place that we expect to see io.EOF, + // which is not an error but the signal that we are done. + // Any other error that happens to align with the start of + // a line is still an error. + if p.err == io.EOF { + p.err = nil + } return nil } switch p.currentByte {