Skip to content

emitYAML adds a trailing newline to multi-line strings that have none #5073

Closed

Description

@lex00

Found with chant 0.124.95 while reading a clone of kubernetes/k8s.io at commit 2b3d9153 offline, for #5067.

emitYAML in packages/core/src/yaml.ts writes every string that contains a newline as a | block. A | block always ends with one newline, so a string with no trailing newline gains one on the round trip.

In that repo, 1004 strings in 5 files change: 1000 CRD descriptions in a Flux gotk-components.yaml, the Slack message text in two AlertmanagerConfigs, and ConfigMap data in two files under apps/slack-infra/.

For ConfigMap data and message templates the extra newline is a real change to what gets applied.

Wanted: |- when the string does not end in a newline, | when it ends in exactly one, |+ when it ends in more than one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugepic:estate-read

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions