readLine returns the next line from the buffer, transparently consuming any line that was previously pushed back by a state that decided not to handle it.
()
| 50 | // line that was previously pushed back by a state that decided not to handle |
| 51 | // it. |
| 52 | func (s *commitScanner) readLine() ([]byte, error) { |
| 53 | if s.pending != nil { |
| 54 | line, err := s.pending, s.pendingErr |
| 55 | s.pending, s.pendingErr = nil, nil |
| 56 | return line, err |
| 57 | } |
| 58 | line, err := s.r.ReadBytes('\n') |
| 59 | if err != nil && err != io.EOF { |
| 60 | return line, err |
| 61 | } |
| 62 | return line, err |
| 63 | } |
| 64 | |
| 65 | // pushBack stashes an unconsumed line so the next state's readLine call sees |
| 66 | // it. Only one line can be pushed back at a time. |
no outgoing calls
no test coverage detected