Description
-
The function uses a custom marshaller to make sure
null
and~
are quoted. It is missing entries forNull
andNULL
which in the YAML spec also denote the missing value. -
I found that tab characters get an extra backslash during the roundtrip (I've filed Custom marshalling does incorrect escaping of some control characters goccy/go-yaml#475) for this. This bug only happens when using a custom marshaller, but not with the default one.
So (1) can be fixed by added the missing cases, but (2) can only be fixed by removing the custom marshaller, making it impossible to fix (1).
But by lucky synchronicity a PR has been filed just 10 hours ago to fix the null
issue upstream (goccy/go-yaml#474). I've tested that branch, and it fixes both (1) and (2) when you remove the custom marshaller.
So it is possible to fix the issue right away with a replace
directive in go.mod
and dropping the custom marshaller:
replace github.com/goccy/go-yaml => github.com/denieryd/go-yaml v0.0.0-20240927195919-fa39d09da8ae
I don't think this is important enough, and we should instead wait a while to see if upstream makes a release. We could fix (1) while we wait, if we want to.