Just check if the over slice is set

This commit is contained in:
Melon 2024-01-21 00:23:22 +00:00
parent 6238999c08
commit fc757fa0a0
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -9,17 +9,16 @@ type CommentReader struct {
r io.Reader
over []byte
mark byte
hit bool
}
var _ io.Reader = &CommentReader{}
func NewCommentReader(r io.Reader, mark byte) *CommentReader {
return &CommentReader{r, nil, mark, false}
return &CommentReader{r, nil, mark}
}
func (c *CommentReader) Read(p []byte) (n int, err error) {
if c.hit {
if c.over != nil {
return 0, io.EOF
}
n, err = c.r.Read(p)