Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yq add blank line in scalar block #1191

Open
ademar59 opened this issue Apr 22, 2022 · 3 comments
Open

yq add blank line in scalar block #1191

ademar59 opened this issue Apr 22, 2022 · 3 comments
Labels

Comments

@ademar59
Copy link

Describe the bug

a new blank line will ba added at the beginning of the the block

this bug will be important when using

yq e '.version = 4' test.yaml

but it will appears with

yq '.' test.yaml

Version of yq: 4.25.4
Operating system: debian
Installed via: git

Input Yaml

version: 3
scaler1: >-
  [
    "A",
    "B",
    "C"
  ]
scaler2: |-
  [
    "A",
    "B",
    "C"
  ]

Command
The command you ran:

yq '.' test.yaml

Actual behavior

version: 3
scaler1: >-
  [

    "A",
    "B",
    "C"
  ]
scaler2: |-
  [
    "A",
    "B",
    "C"
  ]

Expected behavior

version: 3
scaler1: >-
  [
    "A",
    "B",
    "C"
  ]
scaler2: |-
  [
    "A",
    "B",
    "C"
  ]
@mikefarah
Copy link
Owner

This is an issue with the underlying yaml parser :( see go-yaml/yaml#827

@pewter77
Copy link

pewter77 commented Jun 9, 2022

I'm using yq to combine docker compose files. Lines are being added between my commented lines for some reason.

##################
###   WebServer  ###
##################
##################

###   WebServer  ###

##################

Is this related?

@mikefarah
Copy link
Owner

It's hard to tell from that example...I didn't get any extra lines when I put that into a yaml file...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants