Skip to content
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 all newlines from changelog item output #263

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

chancez
Copy link
Contributor

@chancez chancez commented Sep 26, 2024

This fixes the changelog output so it removes both it handles both \n and \r\n. I was finding that when I was outputting changelogs to a file, there were ^M invisible characters in the output. This is because the previous code was only replacing \n but not the \r. When I query the GitHub API, newlines are typically delimited as \r\n so the code should accommodate this case. bufio.Scanner is designed to handle reading text line by line already, so I adapted the textBlockBetween to use buffo.Scanner while preserving existing behavior.

Using bufio.Scanner handles \r\n and \n ensuring we don't leave \r in
the JSON which results in invisible ^M characters in the output which is
particularly annoying when storing result into a file.

Signed-off-by: Chance Zibolski <[email protected]>
@chancez chancez self-assigned this Sep 26, 2024
@aanm aanm merged commit d82b9cc into main Sep 27, 2024
1 check passed
@aanm aanm deleted the pr/chancez/changelog_output branch September 27, 2024 13:23
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.

3 participants