Skip to content

<< short merge tags are not !!merge modified AND are now quoted, breaking some parsers #2677

@nathanmcgarvey-modopayments

Description

I'm not sure if this is a bug or just something I'd like search engines to find:

due to yaml/go-yaml@fbd745b#r182994094
in combination with the version bump here in 8c018da from rc.3 to rc.4 of go-yaml.

Merge tags (<<) from YAML 1.1, when using operators such as *+ seem to now only quote the << operator and !! is not added, either.

go run yq.go eval-all '. as $item ireduce ({}; . *+ $item)' < /tmp/sample.yaml

where sample.yaml is:

---
defaults: &defaults
  foo: bar
  bat: baz
not_defaults:
  <<: *defaults
  foo: pizza
---
defaults2: &defaults2
  foo: bar
  bat: baz
not_defaults2:
  <<: *defaults2
  foo: pizza

example output from rc.3 of go-yaml which is used in v4.52.5 of yq:

---
defaults: &defaults
  foo: bar
  bat: baz
not_defaults:
  <<: *defaults
  foo: pizza
defaults2: &defaults2
  foo: bar
  bat: baz
not_defaults2:
  <<: *defaults2
  foo: pizza

example output from rc.4 of go-yaml which is used in v4.53.2 of yq:

---
defaults: &defaults
  foo: bar
  bat: baz
not_defaults:
  "<<": *defaults
  foo: pizza
defaults2: &defaults2
  foo: bar
  bat: baz
not_defaults2:
  "<<": *defaults2
  foo: pizza

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions