We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to unmarshal a nested YAML into a map[string]interface{} fails. If the order of the path and type keys changes this test will pass.
map[string]interface{}
path
type
package main import ( "fmt" "github.com/goccy/go-yaml" ) const good = ` a: - name: foo value: path: /var/log/syslog type: x ` const bad = ` a: - name: foo value: type: x path: /var/log/syslog ` func main() { var goodMap map[interface{}]interface{} if err := yaml.Unmarshal([]byte(good), &goodMap); err != nil { panic("good map fails" + err.Error()) } var badMap map[interface{}]interface{} if err := yaml.Unmarshal([]byte(bad), &badMap); err != nil { panic("bad map fails" + err.Error()) } fmt.Println("OK") }
want: OK
OK
got:
panic: bad map fails[5:7] unexpected key name 2 | a: 3 | - name: foo 4 | value: > 5 | type: x 6 | path: /var/log/syslog ^
The text was updated successfully, but these errors were encountered:
To be precise, it seems to be caused by the tab character (\t) immediately after type:.
\t
type:
Sorry, something went wrong.
@goccy
There's also an unexpected behaviour if I try to parse a structure like this:
` customer: first_name: Dorothy family_name: Gale `
Where the keys of the object are indented using the Tab. It seems that the library can't recognize customer as an object.
customer
Thank you for your reporting ! I'll fix this problem
Successfully merging a pull request may close this issue.
Trying to unmarshal a nested YAML into a
map[string]interface{}
fails. If the order of thepath
andtype
keys changes this test will pass.want:
OK
got:
The text was updated successfully, but these errors were encountered: