Skip to content

[BREAKING CHANGE] v0.3.2: New Reader type to satisfy io.Reader

Compare
Choose a tag to compare
@wneessen wneessen released this 20 Oct 16:48
· 1237 commits to main since this release
a44383e

Initially the Msg implemented a io.Reader interface by providing a Read 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 a bufio.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. The Reader type satisfies the io.Reader interface and returns the data properly as well as returns EOF in case the end of data is reached.

The initial Read() method has been removed from the Msg type and instead a NewReader() method has been introduced that returns the Reader type.

BREAKING CHANGE: Since we remove the Read method from the Msg the Msg does not satisfy the io.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