Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/cmdio/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func renderJson(w io.Writer, v any) error {
return err
}
_, err = w.Write(pretty)
if err != nil {
return err
}
_, err = w.Write([]byte("\r\n"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please stick to \n only. On Windows folks seem to get by with \n alone as well.

Copy link
Copy Markdown
Contributor Author

@shreyas-goenka shreyas-goenka Jun 6, 2023

Choose a reason for hiding this comment

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

That seems to be the case when using \n with println. I am not so sure about io writer though. We do the same for sync progress events:

bw.WriteString("\r\n")

Maybe it's worthwhile testing it out on windows?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yep, please check it on windows

Copy link
Copy Markdown
Contributor

@pietern pietern Jun 8, 2023

Choose a reason for hiding this comment

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

fmt.Println goes through an io.Writer, the two operate at different levels.

Please file a follow up to check out if \n alone is good enough. Use of \r\n on Unix systems could be problematic so I prefer using \n everywhere. If it's good enough for the Go stdlib it is good enough for us.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Followup filed at #451

return err
}

Expand Down