Skip to content

Commit 2c9877d

Browse files
author
Julien Pivotto
authored
Merge pull request #444 from abursavich/expfmt-eof
expfmt: only ignore io.EOF errors in TextParse.startOfLine
2 parents d888bfa + d074dea commit 2c9877d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

expfmt/text_parse.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ func (p *TextParser) reset(in io.Reader) {
142142
func (p *TextParser) startOfLine() stateFn {
143143
p.lineCount++
144144
if p.skipBlankTab(); p.err != nil {
145-
// End of input reached. This is the only case where
146-
// that is not an error but a signal that we are done.
147-
p.err = nil
145+
// This is the only place that we expect to see io.EOF,
146+
// which is not an error but the signal that we are done.
147+
// Any other error that happens to align with the start of
148+
// a line is still an error.
149+
if p.err == io.EOF {
150+
p.err = nil
151+
}
148152
return nil
149153
}
150154
switch p.currentByte {

0 commit comments

Comments
 (0)