mustPeek peeks at the next n bytes without advancing the reader. If an error occurs, it sets d.err and returns false. If io.EOF is encountered, it sets d.err to a more descriptive error.
(n int)
| 826 | // If an error occurs, it sets d.err and returns false. |
| 827 | // If io.EOF is encountered, it sets d.err to a more descriptive error. |
| 828 | func (d *Decoder) mustPeek(n int) ([]byte, bool) { |
| 829 | b, ok := d.peek(n) |
| 830 | if !ok { |
| 831 | if errors.Is(d.err, io.EOF) { |
| 832 | d.setSyntaxErrorf("unexpected EOF") |
| 833 | } |
| 834 | } |
| 835 | return b, ok |
| 836 | } |
| 837 | |
| 838 | // mustPeekBuffered peeks at all currently buffered bytes without advancing the reader. |
| 839 | // If no bytes are buffered, it peeks at least 1 byte. |
no test coverage detected