Closed louhde closed 5 months ago
Describe the bug When a string contains simple quote and [ symbol, the simple quote is encoded with double single quote
To Reproduce
main.go
package main import ( "os" "gopkg.in/yaml.v2" ) type Test struct { Name string `yaml:"name"` Test string `yaml:"test"` } func main() { test := Test{ Name: "NAME", Test: "['value', 'value2']", } out, err := yaml.Marshal(test) if err != nil { panic(err) } err = os.WriteFile("test.yaml", out, 0644) if err != nil { panic(err) } }
test.yaml
name: NAME test: '[''value'', ''value2'']'
Expected behavior
name: NAME test: "['value', 'value2']"
Version Variables
I just see that there are two differents go-yaml package the official one and yours, sorry the issue does not concern your package. I close
Describe the bug When a string contains simple quote and [ symbol, the simple quote is encoded with double single quote
To Reproduce
main.go
test.yaml
Expected behavior
test.yaml
Version Variables