mirror of
https://github.com/goccy/go-yaml.git
synced 2025-12-08 06:09:57 +00:00
Avoid returning an error for null document (#721)
This commit is contained in:
parent
0203d69117
commit
427b18e1b7
2 changed files with 470 additions and 456 deletions
|
|
@ -1892,7 +1892,7 @@ func (d *Decoder) parse(ctx context.Context, bytes []byte) (*ast.File, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if v != nil {
|
if v != nil || (doc.Body != nil && doc.Body.Type() == ast.NullType) {
|
||||||
normalizedFile.Docs = append(normalizedFile.Docs, doc)
|
normalizedFile.Docs = append(normalizedFile.Docs, doc)
|
||||||
cm := CommentMap{}
|
cm := CommentMap{}
|
||||||
maps.Copy(cm, d.toCommentMap)
|
maps.Copy(cm, d.toCommentMap)
|
||||||
|
|
|
||||||
924
decode_test.go
924
decode_test.go
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue