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

encoding/csv: clarify that Writer uses different line break than RFC 4180 by default #67290

Closed

Conversation

nobishino
Copy link
Contributor

@nobishino nobishino commented May 10, 2024

Package documentation of encoding/csv says:

this package supports the format described in RFC 4180.

According to section 2 of RFC 4180:

Each record is located on a separate line, delimited by a line break (CRLF).

On the other hand, Writer uses LF (not CRLF) as newline character by default.

If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.

Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.

@gopherbot
Copy link

This PR (HEAD: 1523038) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@nobishino nobishino force-pushed the nits-fix-encoding-csv-godoc branch from 1523038 to 31222e0 Compare May 11, 2024 02:36
@gopherbot
Copy link

This PR (HEAD: 31222e0) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@nobishino nobishino force-pushed the nits-fix-encoding-csv-godoc branch from 31222e0 to e322fed Compare May 11, 2024 02:43
@gopherbot
Copy link

This PR (HEAD: e322fed) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

…4180

Package documentation of encoding/csv says:

> this package supports the format described in RFC 4180.

https://pkg.go.dev/encoding/csv#section-documentation

According to section 2 of RFC 4180:

> Each record is located on a separate line, delimited by a line break (CRLF).

https://www.rfc-editor.org/rfc/rfc4180.html#section-2

On the other hand, encoding/csv.Writer uses LF (not CRLF) as newline character by default.

> If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.

https://pkg.go.dev/encoding/csv#Writer

https://github.com/golang/go/blob/1259a30a588392e6a1efbed9e0c7d893c72187fa/src/encoding/csv/writer.go#L115-L119

Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.
@nobishino nobishino force-pushed the nits-fix-encoding-csv-godoc branch from e322fed to 489167e Compare May 11, 2024 02:50
@gopherbot
Copy link

This PR (HEAD: 489167e) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link

Message from のびしー:

Patch Set 4:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 4: Auto-Submit+1 Code-Review+2 Commit-Queue+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2024-05-11T03:10:47Z","revision":"0cee453234d5daa3b108d99360ffb1353344ee9f"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from のびしー:

Patch Set 4:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 4: -Commit-Queue


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4:

This CL has passed the run


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4: LUCI-TryBot-Result+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request May 13, 2024
…4180 by default

Package documentation of encoding/csv says:

> this package supports the format described in RFC 4180.

According to section 2 of RFC 4180:

> Each record is located on a separate line, delimited by a line break (CRLF).

On the other hand, Writer uses LF (not CRLF) as newline character by default.

> If [Writer.UseCRLF] is true, the Writer ends each output line with \r\n instead of \n.

Strictly speaking, this behavior is different from RFC 4180.
Package documentation would improve if we clarify that point.

Change-Id: I120e9332b593e1ac9ed8e49f6f8419ea88efc57d
GitHub-Last-Rev: 489167e
GitHub-Pull-Request: #67290
Reviewed-on: https://go-review.googlesource.com/c/go/+/584835
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
@gopherbot
Copy link

Message from Dmitri Shuralyov:

Patch Set 5: Auto-Submit+1 Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

This PR is being closed because golang.org/cl/584835 has been merged.

@gopherbot gopherbot closed this May 13, 2024
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.

None yet

2 participants