It seems like that go-jsonnet detects a false-positive YAML stream when std.parseYaml parses a YAML document that contains --- in data. It is also an inconsistent behavior with the C++ version.
How to reproduce
Suppose that we have the next test.jsonnet:
std.parseYaml('foo---: bar')
This is not a YAML stream, and it is not far from the example shown in the std library reference. So I expect this input produces the next result:
The C++ implementation actually produces this expected result. However, go-jsonnet produces the next output.
$ jsonnet -v
Jsonnet commandline interpreter (Go implementation) v0.19.1
$ jsonnet test.jsonnet
[
{
"foo---": "bar"
}
]
I believe this is because builtinParseYAML (builtins.go#L1375) detects YAML streams too loosely.
It seems like that go-jsonnet detects a false-positive YAML stream when
std.parseYamlparses a YAML document that contains---in data. It is also an inconsistent behavior with the C++ version.How to reproduce
Suppose that we have the next
test.jsonnet:std.parseYaml('foo---: bar')This is not a YAML stream, and it is not far from the example shown in the std library reference. So I expect this input produces the next result:
{ "foo---": "bar" }The C++ implementation actually produces this expected result. However, go-jsonnet produces the next output.
I believe this is because
builtinParseYAML(builtins.go#L1375) detects YAML streams too loosely.