google / google/yamlfmt

Infinite adding EOL

Open
#169 6 comments 3 reactions 0 assignees View on GitHub
yaml_v3_problem
Dominant language
Go
Stars
1.8k
Forks
75
PR merge metrics
No merged PRs in 30d

Description

Hi!

I have a YAML file embedding a Jinja template (cames from Ansible):

```yaml
list: >-
[
{% for host in servers %}
{"ip": "{{ host }}"},
{% endfor %}
]
```

Using the dry flag, everything seems ok:

```bash
$ yamlfmt -dry test.yaml
2024/04/23 13:49:10 No files will be changed.
```

Without the dry flag a new line is added:

```bash
$ yamlfmt test.yaml
$ cat test.yaml
list: >-
[

{% for host in servers %}
{"ip": "{{ host }}"},
{% endfor %}
]
```

Every time I run `yamlfmt` a new line is added.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.