profile
viewpoint

Ask questionsparsing fails when %YAML version is 1.2

Go-yaml fails to parse the following YAML 1.2 document with the error "found incompatible YAML document". It currently fails for any version other than 1.1.

%YAML 1.2
--- text
go-yaml/yaml

Answer questions niemeyer

The behavior in v3 is to parse the yes/no literals as booleans only if you explicitly attempt to read them into a bool. Otherwise these are just strings, as 1.2 defines. So it's neither here nor there, but rather a behavior that attempts to smooth out the transition in the least painful way possible.

The behavior when the YAML 1.2 header is observed will be defined at the time we actually introduce support for it. So far requests have been pretty much non-existent.

useful!

Related questions

v3 panics on bad input hot 1
v3 equivalent of v2's MapSlice and MapItem? hot 1
unmarshal with comments provide wrong structure hot 1
Head comments in list elements misplaced hot 1
source:https://uonfu.com/
Github User Rank List