mustReadByte reads a single byte from 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.
()
| 712 | // If an error occurs, it sets d.err and returns false. |
| 713 | // If io.EOF is encountered, it sets d.err to a more descriptive error. |
| 714 | func (d *Decoder) mustReadByte() (byte, bool) { |
| 715 | b, ok := d.readByte() |
| 716 | if !ok { |
| 717 | if errors.Is(d.err, io.EOF) { |
| 718 | d.setSyntaxErrorf("unexpected EOF") |
| 719 | } |
| 720 | } |
| 721 | return b, ok |
| 722 | } |
| 723 | |
| 724 | // unreadByte unreads the last byte read from the reader. |
| 725 | // If an error occurs, it sets d.err and returns false. |
no test coverage detected