-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency to bufio.Reader
in internal carv1
package
#160
Conversation
Remove dependency to `bufio.Reader` in internal `carv1` package that seems to be mainly used for peeking a byte to return appropriate error when stream abruptly ends, relating to #36. This allows simplification of code across the repo and remove all unnecessary wrappings of `io.Reader` with `bufio.Reader`. This will also aid simplify the internal IO utilities which will be done in future PRs. For now we simply remove dependency to `bufio.Reader` See: - #36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, so we have a carv1 inside carv2? is that going to be deduped at some point?
I have some memory of this Peek()
code, trying to make it give proper errors on EOF vs "can't decode this uvarint". Other than that, I don't see a good reason to hold on to bufio.Reader; so go ahead and yeet it! This looks good to me. I'd be happy to see this migrate into the top level package too, I don't think there's a strong reason to keep it otherwise since that Peek()
is not protecting an unbounded reader or anything.
Yep the context behind this is captured in #104. TLDR;
Yeah that would be nice; the bad thing is we can't roll out breaking changes so we have to leave the |
SGTM. For what it's worth I'm not convinced we can simply deduplicate the carv1 packages; the v0 ones in master have APIs that limit what we can do, like We can certainly try to deduplicate some of it though. |
.. but isn't |
mm good point; is that OK as far as Go API etiquette goes? @mvdan what do you think? |
It's technically a breaking change, as one could e.g. pass ReadHeader as a parameter to a func that expects the bufio type. It's likely that it would break noone in practice though, so we could always try and see. It's a v0 after all. I haven't checked if any other bits of the API needed changing for their uses in carv2. |
Remove dependency to
bufio.Reader
in internalcarv1
package thatseems to be mainly used for peeking a byte to return appropriate error
when stream abruptly ends, relating to #36. This allows simplification
of code across the repo and remove all unnecessary wrappings of
io.Reader
withbufio.Reader
. This will also aid simplify theinternal IO utilities which will be done in future PRs. For now we
simply remove dependency to
bufio.Reader
.Relates to: