You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"github.com/ghodss/yaml"
)
type X struct {
Y string
}
func main() {
// single-quotes are ok
b, _ := yaml.Marshal(X{Y: `'`})
fmt.Println(string(b))
// new lines with single quotes are ok
b, _ = yaml.Marshal(X{Y: `'\n`})
fmt.Println(string(b))
// single quotes with wrapped lines causes failed validation
b, _ = yaml.Marshal(X{Y: `' 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789`})
fmt.Println(string(b))
I appreciate that the yaml marshaller outputs valid yaml, but the fact that it fails in some of the most popular online validators is a bit of a frustration.
Is there anything that could be done to tackle this issue?
The text was updated successfully, but these errors were encountered:
When I have a long string value that also contains a single quote, the marshalled yaml fails validation with a number of online yaml validators.
e.g. the third example generated by this code fails in :
https://codebeautify.org/yaml-validator
https://onlineyamltools.com/validate-yaml
The above code outputs :
I appreciate that the yaml marshaller outputs valid yaml, but the fact that it fails in some of the most popular online validators is a bit of a frustration.
Is there anything that could be done to tackle this issue?
The text was updated successfully, but these errors were encountered: