-
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
Marshal From yaml.Node gives invalid Yaml #454
Comments
I believe this has been fixed shortly after the release with fc85683. Will close this, but please reopen if you can reproduce after ensuring your tree is up to date. |
Here is my go.mod module retainyamlcommments
go 1.12
require (
github.com/davecgh/go-spew v1.1.1 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.0-20190409140830-cdc409dda467
) Please correct me if I am wrong, but this is the latest commit. |
@niemeyer Cannot Reopen for whatever reason |
@niemeyer - we also took the latest |
Thanks, I'll look into it. |
This should have been fixed by 55513ca. Please let me know if you you find any other issues. |
@niemeyer - im trying to run the program with the issue against commit |
@RaynDol If you're getting the exact same result you're just not running the right code. I've copy & pasted the logic and can go back and forth between the two revisions and get the error or not depending on which revision I'm running. |
@niemeyer - not sure that I got you, I use the latest version see go.mod
and run the following code which includes valid yaml
The output is
what am I missing ? does it works for you ? please see that the comment is starting the array as before .... expected yaml
if I remove the comment (first app) it looks ok, but with the comment change the yaml to invalid yaml |
@RaynDol That's not the exact same output, and that's valid yaml that represents the same data that was marshalled. I'm happy to evolve the formatting so comments are placed in the locations most people would appreciate, but that's neither the same output nor invalid, so separate issue. |
Summary
Reading a valid yaml spec into a yaml.Node and then Marshalling doesn't produce valid yaml.
Occurrence
Go version: go1.12.3 windows/amd64
Branch: v3
Commit: cdc409d
Example
Produces the following yaml
Expected yaml
The text was updated successfully, but these errors were encountered: