yq
yq copied to clipboard
Leading empty line gets stripped from block scalar
Hi,
Thank you for yq!
Describe the bug I am using yq to merge gitlab ci yml files.
I noticed that multi-ling strings in lists have the first line removed and a 2
inserted after the |
symbol if the first line is empty.
The yaml validators I tried claim that the snippets are valid, which makes me think that this is a bug.
Version of yq: 4.18.1 Operating system: mac Installed via: homebrew
Input Yaml Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
broken.yml:
- |
my
ci commands
here
- another command
working.yml:
- |
my
ci commands
here
- another command
Command The command you ran:
yq broken.yml
Actual behavior
- |2
my
ci commands
here
- another command
Expected behavior
- |
my
ci commands
here
- another command
That is strange - I've found the issue logged in the underlying yaml parser yq uses: https://github.com/go-yaml/yaml/issues/701