-
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
v3: FoldedStyle yaml.Node results in unexpected newlines #804
Comments
gs-opensource-bot
pushed a commit
to goldmansachs/yaml
that referenced
this issue
Mar 20, 2023
When using: >- someline more The encoder would emit: >- someline more The issue was introduced in the original translation from C to Go. In the C code the MOVE macro would advance the start pointer of the string. In the Go case "k = 0" points to the start of the string where in the C case it would be the read pointer. Fix it. Also address bound checks to not go beyond the string (I assume in the C code there is an explicit NUL or at least some NUL). Fixes: go-yaml#804
zecke
pushed a commit
to zecke/go-yaml
that referenced
this issue
May 3, 2023
When using: >- someline more The encoder would emit: >- someline more The issue was introduced in the original translation from C to Go. In the C code the MOVE macro would advance the start pointer of the string. In the Go case "k = 0" points to the start of the string where in the C case it would be the read pointer. Fix it. Also address bound checks to not go beyond the string (I assume in the C code there is an explicit NUL or at least some NUL). Fixes: go-yaml#804
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When Marshalling/Encoding a scalar YAML node with the folded multi-line style I see an unexpected new line in the encoded YAML.
I've added some test cases in a branch in my fork.
A
yaml.Node
withstyle.Folded
and the followingValue
:Is marshalled with a newline between foo and bar:
I'm expecting it to be marshalled as follows:
Reading the spec I believe my expectations are correct.
The snippet
Example 8.10. Folded Lines
shows an indented line and it does not include the additional newline.The impact of this is that marshalling unmarshalling a YAML string into a YAML node and back into a string again does not result in the same string value within the node.
The text was updated successfully, but these errors were encountered: