Skip to content

Commit

Permalink
Merge pull request #444 from abursavich/expfmt-eof
Browse files Browse the repository at this point in the history
expfmt: only ignore io.EOF errors in TextParse.startOfLine
  • Loading branch information
roidelapluie committed Feb 20, 2023
2 parents d888bfa + d074dea commit 2c9877d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions expfmt/text_parse.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 2c9877d

Please sign in to comment.