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
I would like to parse each object separately and make some processing (i.e. validation)
I've tried the following approach ():
file, err:=os.Open(yamlFile)
iferr!=nil {
log.Fatal(err)
}
for {
varyamlObjectanydec:=yaml.NewDecoder(file)
iferr:=dec.Decode(&yamlObject); err!=nil {
log.Fatalf("Decoding error: %s", err)
}
// some processing goes here
}
However, this parses only the first yaml block inside the file and the second iteration of for loop failes with EOF.
I've noticed this solution (somewhat like this) here. I understand, that this solution for another go-yaml, however, I would like to use this implementation
Also, I've noticed this issue which is also about multi-yaml file, so I've tried to initialize File type:
Hello!
I've got a file with multiple yaml objects with the same structure. It looks like this:
I would like to parse each object separately and make some processing (i.e. validation)
I've tried the following approach ():
However, this parses only the first yaml block inside the file and the second iteration of
for
loop failes withEOF
.I've noticed this solution (somewhat like this) here. I understand, that this solution for another go-yaml, however, I would like to use this implementation
Also, I've noticed this issue which is also about multi-yaml file, so I've tried to initialize
File
type:And all I've got is
EOF
So, how can I properly parse multi-yaml file?
The text was updated successfully, but these errors were encountered: