Skip to content

Commit 5aa24e6

Browse files
author
anahan
committed
Return nil if buf empty on EOF in line/ReadOne
1 parent 837631f commit 5aa24e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/line/read.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ func ReadOne(r *bufio.Reader, retBufOnEOF bool) ([]byte, error) {
1313
line, err := r.ReadSlice('\n')
1414

1515
if errors.Is(err, io.EOF) {
16-
if retBufOnEOF {
17-
return line, nil
16+
if retBufOnEOF && len(line) > 0 {
17+
return line, io.EOF
1818
}
1919

2020
return nil, err

0 commit comments

Comments
 (0)