Closed ba3n3 closed 2 months ago
Describe the bug yq doesn't count the head comment(s) and its following newlines when reporting line numbers
Version of yq: 4.44.3 Operating system: linux Installed via: binary release
Input Yaml data1.yml:
--- # head comment bar: # i can put many # comments here foo: bar # extra mid file comment baz: bam ...
data2.yml:
--- bar: # i can put many # comments here foo: bar # extra mid file comment baz: bam ...
Command The command you ran:
yq eval '".bar.foo: " + (.bar.foo | line) + ", .baz: " + (.baz | line)' data1.yml data2.yml
(just for demonstration, same result when just evaluating .bar | line)
.bar | line
Actual behavior
.bar.foo: 4, .baz: 8 .bar.foo: 4, .baz: 8
Expected behavior
.bar.foo: 6, .baz: 10 .bar.foo: 4, .baz: 8
The 2 lines from the head comment count.
Additional context It doesn't matter how many following newlines are there.
https://github.com/mikefarah/yq/issues/1354
Describe the bug yq doesn't count the head comment(s) and its following newlines when reporting line numbers
Version of yq: 4.44.3 Operating system: linux Installed via: binary release
Input Yaml data1.yml:
data2.yml:
Command The command you ran:
(just for demonstration, same result when just evaluating
.bar | line
)Actual behavior
Expected behavior
The 2 lines from the head comment count.
Additional context It doesn't matter how many following newlines are there.