-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Hi all, big fan. Been chasing a bug for a while and finally found it today. Here is the repro:
func TestEmptyLine(t *testing) {
iso := map[string]any{
"attrs": []any{
map[string]any{
"value": "\ndebug",
},
},
}
var node yaml.Node
err = node.Encode(iso)
require.NoError(t, err, "Failed to parse YAML attributes")
}
Encode returns an error saying: "yaml: line 1: did not find expected key". Encode does a yaml generation step, then sends that yaml back through the parser to update Node. I got in the middle there and say this as the generated yaml:
attrs:
- value: |4-
debug
I found that if the string does not contain a newline at the start, the encoding works fine.
Metadata
Metadata
Assignees
Labels
No labels