-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
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
bug: nested arrays are flattened #167
Comments
Thanks for opening an issue! Unfortunately this falls under problems with the underlying yaml parser, which I can't easily address in the near future for reasons explained in this post. |
I think in this case package main
import (
"fmt"
"gopkg.in/yaml.v3"
)
const input = `
- - one
- two`
func main() {
var parsed any
err := yaml.Unmarshal([]byte(input), &parsed)
fmt.Println(parsed, err) // [[one two]] <nil>
} digging into a parse into a |
To clarify, the issues I have tagged with this label are all around the way the yaml library is used. It isn't necessarily designed for the way |
wth, this "bug" broke my configuration, thankfully I'm tracking this specific "ansible" configuration via git and was able to notice an issue with flattened array-of-arrays quite quickly. |
Having trouble reproducing this at the moment. Ran with the following yaml from the original comment:
Using yamlfmt from latest master and from v0.11.0 on both Linux and Windows, the nested arrays were retained on formatting.
(same result on Windows) There must be another detail about the yaml, the system, or the yamlfmt configuration that causes the bug to trigger. Need more information to properly reproduce. @timruffles or @den-is are there any other details you can share about the yaml or other reproduction cases? |
nested arrays are flattened:
tested with v0.11.0
The text was updated successfully, but these errors were encountered: