[BREAKING CHANGE] v0.3.2: New Reader type to satisfy io.Reader #69
Closed
wneessen
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Initially the
Msg
implemented aio.Reader
interface by providing aRead
methods. Unfortunately the method chosen for this method was very naive. It works fine for smaller messages but could result in wrong data returned for larger messages or i. e. used in abufio.Reader
with non consecutive reads. Since we did not track the position and state of the reading operation, duplicate data might be returned to the caller eventually even leading into infinite loops.This release fixes the issue be introducing a new
Reader
type. TheReader
type satisfies theio.Reader
interface and returns the data properly as well as returnsEOF
in case the end of data is reached.The initial
Read()
method has been removed from theMsg
type which and instead aNewReader()
method has been introduced that returns theReader
type.BREAKING CHANGE: Since we remove the
Read
method from theMsg
theMsg
does not satisfy theio.Reader
interface anymore, which is considered a breaking change. But given that the returned data of the original implementation might return duplicate or wrong data, this breaking change is considered as the right decision.What's Changed
Full Changelog: v0.3.1...v0.3.2
This discussion was created from the release [BREAKING CHANGE] v0.3.2: New Reader type to satisfy io.Reader.
Beta Was this translation helpful? Give feedback.
All reactions