Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Jerska
Copy link
Contributor

@Jerska Jerska commented Feb 16, 2022

Closes #118

This PR introduces a new Encoder option, toggled with SetAddExtraNewline.
Its default value is true, matching encoding/json's behavior.

Setting it to false allows to use the encoder without having to handle this newline with the output.

There are for instance multiple locations in the tests where newlines are explicitly added to the expected value. Using this option would allow not to have to think about it, making the code a little bit easier to follow.

Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, thanks for the contribution!

@achille-roussel achille-roussel merged commit 886f222 into segmentio:master Feb 16, 2022
@Jerska Jerska deleted the encode-add-extra-newline branch February 16, 2022 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: add an option to prevent encoder from adding a newline on Encode
2 participants