-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support CRLF endings #450
Comments
same problem here with the following code and gopkg.in/yaml.v3:
|
we are having the same issue on windows machines when using V3 version. |
Hi @niemeyer, Thanks for your work on this library, and your care for the OSS. ❤️ I consider this bug to be critical, since it makes this package unusable for Windows users. This is preventing us to adopt v3 (go-task/task#201). |
@niemeyer I've juste upgraded from v2 to v3 and encountered this issue. |
Thanks for the reports. I'll get that fixed. |
I'm unable to reproduce the error locally, even if I take out the commits from the last few months one by one. Can someone that is being affected by this problem please provide a self-contained reproducer that does not involve reading an external file? Maybe I'm missing something about how that file really looks like. |
@niemeyer just tested, it seems to be ok with the latest commit of v3 branch https://github.com/itscaro/go-yaml-bug-crlf The error varies in fonction of the yaml.
|
That's because |
This file has the CRLFs in it that will cause the problem. It's un-parseable by yaml v3. |
@rfay did you try with the latest commit of v3 branch? @andreynering The tests I did were with v3 branch, not master, initially I thought it was master :) sorry for the misinfo
|
No, I backed v3 out completely, had this and other trouble with v3, so the value's not there. However, I added a test in our app for this situation. It will be a while before we try v3 again. Upgraded to it for the hope of comment-preservation, but it seems that isn't mature yet. I definitely don't see anything mentioning this issue in 117fdf0 and don't see any tests for the CRLF problem either, or a mention of that anywhere. Is it really testing on go 1.4??? Really? And only one test? https://travis-ci.org/go-yaml/yaml/jobs/554663638 And only on one OS? |
@niemeyer I've just updated my repo the test is self-contained https://github.com/itscaro/go-yaml-bug-crlf
|
Hey @rfay, let's be more kind to maintainers, they're doing free work for you (and the community). I think Travis is probably running all tests, but not printing the entire output. Something to check, though... |
@rfay That's not how Travis works.. what you're looking at is a job, not the build. If you want to see all 10 Go versions being tested (1.4 to 1.12 plus tip) you need to click on that "Build" link which is the parent of that job. @itscaro Thanks for the test case. I've just run it with latest v3 and it works fine. I've also added a trivial test with 674ba3e just in case. So considering this a non-issue. |
Seems a bit awkward, by the way. So much misdirected excitement above for a non-issue. If someone has a self-contained test case they'd like me to look into, please feel free to comment here still. |
Hi @niemeyer,
Just making it clear that this was indeed a real issue until 117fdf0. I just tested it: on the previous commit, it fails, but with this one it's somehow fixed. So while I agree with your comment above, I kindly disagree this was a non-issue. Sorry for the noise but thanks for your patience. 🙂 |
Witnessed behavior
go-yaml
does not support CRLF line endings when reading a file directly (which would be the main use case). For instance, the following code won't work if the loaded file is written on Windows:With the following file content:
Here's the error:
yaml: line 3: mapping values are not allowed in this context
Expected behavior
Just work as usual.
The text was updated successfully, but these errors were encountered: