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

Spurious newline added with yq -i when multiline strings are present #2074

Open
cbeck88 opened this issue Jun 19, 2024 · 0 comments
Open

Spurious newline added with yq -i when multiline strings are present #2074

cbeck88 opened this issue Jun 19, 2024 · 0 comments
Labels

Comments

@cbeck88
Copy link

cbeck88 commented Jun 19, 2024

Describe the bug

When editing certain .yaml files in-place with yq that contain multiline strings, it adds newlines that don't belong.
It adds more newlines every time it runs over these files.

Version of yq: 4.43.1
Operating system: linux
Installed via: binary release

Input Yaml

data1.yaml:

image:
  tag: "0.55.3"
env:
  MM_CONFIGS: >-
    '{
      "params": {
        "a": "400",
        "b": "200"
      }
     }'

Command

yq eval ".image.tag = \"0.55.4\"" -i data1.yaml

Actual behavior

image:
  tag: "0.55.4"
env:
  MM_CONFIGS: >-
    '{

      "params": {
        "a": "400",
        "b": "200"
      }
     }'

Expected behavior

image:
  tag: "0.55.4"
env:
  MM_CONFIGS: >-
    '{
      "params": {
        "a": "400",
        "b": "200"
      }
     }'

Additional context

I haven't been able to find any good workarounds for this issue. Any tips short of a full fix would be greatly appreciated. Thanks

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

1 participant