From 23ede366d2f5c8875d537b2e1d9e1c91610086b6 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Fri, 15 Nov 2024 18:57:08 +0900 Subject: [PATCH] clear pathMap keys --- parser/parser.go | 1 + parser/parser_test.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/parser/parser.go b/parser/parser.go index 55db6b9..169d5ed 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -830,6 +830,7 @@ func (p *parser) setSameLineCommentIfExists(ctx *context, node ast.Node) error { } func (p *parser) parseDocument(ctx *context) (*ast.DocumentNode, error) { + p.pathMap = make(map[string]ast.Node) startTk := p.currentToken() p.progress(1) // skip document header token body, err := p.parseToken(ctx, p.currentToken()) diff --git a/parser/parser_test.go b/parser/parser_test.go index 7d0eb10..66ad5e3 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -133,6 +133,13 @@ a: !tag a: b: c +`, + ` +foo: xxx +--- +foo: yyy +--- +foo: zzz `, } for _, src := range sources {