WIP: Refactor entire hosts reading and writing code #1
@ -9,17 +9,16 @@ type CommentReader struct {
|
|||||||
r io.Reader
|
r io.Reader
|
||||||
over []byte
|
over []byte
|
||||||
mark byte
|
mark byte
|
||||||
hit bool
|
|
||||||
}
|
}
|
||||||
alfred marked this conversation as resolved
|
|||||||
|
|
||||||
var _ io.Reader = &CommentReader{}
|
var _ io.Reader = &CommentReader{}
|
||||||
|
|
||||||
func NewCommentReader(r io.Reader, mark byte) *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) {
|
func (c *CommentReader) Read(p []byte) (n int, err error) {
|
||||||
if c.hit {
|
if c.over != nil {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
n, err = c.r.Read(p)
|
n, err = c.r.Read(p)
|
||||||
|
Loading…
Reference in New Issue
Block a user
Whats this used for (hit)?
It's only checked in one place.