Skip to content

Commit

Permalink
Fixed bad line entry for #1422
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefarah committed Nov 15, 2022
1 parent b202ccc commit cb609a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
5 changes: 4 additions & 1 deletion pkg/yqlib/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ func parseSnippet(value string) (*yaml.Node, error) {
if len(parsedNode.Node.Content) == 0 {
return nil, fmt.Errorf("bad data")
}
return unwrapDoc(parsedNode.Node), err
result := unwrapDoc(parsedNode.Node)
result.Line = 0
result.Column = 0
return result, err
}

func recursiveNodeEqual(lhs *yaml.Node, rhs *yaml.Node) bool {
Expand Down
20 changes: 10 additions & 10 deletions pkg/yqlib/lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!null",
Value: "null",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
Expand All @@ -48,8 +48,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!int",
Value: "3",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
Expand All @@ -58,8 +58,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!str",
Value: "cat",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
Expand All @@ -68,8 +68,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!float",
Value: "3.1",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
{
Expand All @@ -78,8 +78,8 @@ var parseSnippetScenarios = []parseSnippetScenario{
Kind: yaml.ScalarNode,
Tag: "!!bool",
Value: "true",
Line: 1,
Column: 1,
Line: 0,
Column: 0,
},
},
}
Expand Down

0 comments on commit cb609a1

Please sign in to comment.