-
-
Notifications
You must be signed in to change notification settings - Fork 219
Multi-line string marshal output not using block notation consistently #846
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Marshaling a multi-line string usually results in block notation, but somehow if adding a colon : to the end of the string or starting with an escaped quote character \" the block notation is no longer used.
hello: |-\n \n \"name\"\n
vs
hello: \"\\\"name\\\":\"\n
To Reproduce
https://go.dev/play/p/ehf6lfGE7qW
Marshaling map[string]string{"hello": "\"name\":"} does not use block notation, map[string]string{"hello": "\n\"name\""} uses block notation.
Expected behavior
Block notation being used consistently for all multi-line strings.
Version Variables
- Go version: 1.26.0
- go-yaml's Version: v1.19.2
Additional context
I stumbled across this when trying to add javascript code examples as multi-line strings to an OpenAPI spec file (yaml format).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working