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 delete array last item with commet is not valid yaml #1729

Open
jerrybean opened this issue Jul 17, 2023 · 1 comment
Open

yq delete array last item with commet is not valid yaml #1729

jerrybean opened this issue Jul 17, 2023 · 1 comment
Labels

Comments

@jerrybean
Copy link

jerrybean commented Jul 17, 2023

Describe the bug
see as below example

Version of yq: 4.34.2
Operating system: linux
Installed via: binary
yq (https://github.com/mikefarah/yq/) version v4.34.2

Input Yaml

data1.yml:

a:
  b: 
    c: #xx
      - name: "name1"
        age: 1

Command
The command you ran:

yq -i  'del(.a.b.c[] | select(.name == "name1"))' data1.yml

Actual behavior

a:
  b:
    c: #xx
[]

Expected behavior

a:
  b:
    c: [] #xx 

Additional context
current yaml is not valid

@mikefarah
Copy link
Owner

This looks like an issue with the underlying yaml parser :( https://github.com/go-yaml/yaml/issues - please raise an issue there

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

2 participants