Skip to content

fix superfluous comma in flow mappings - #22

Open
Fidelxyz wants to merge 1 commit into
braydonk:v3from
Fidelxyz:fix/superfluous-comma-flow-mapping
Open

fix superfluous comma in flow mappings#22
Fidelxyz wants to merge 1 commit into
braydonk:v3from
Fidelxyz:fix/superfluous-comma-flow-mapping

Conversation

@Fidelxyz

Copy link
Copy Markdown

When a flow mapping ends in non-canonical mode, the emitter no longer writes a trailing comma before the closing } merely because comments are pending.

The comma was a leftover from upstream (117fdf0) and is unnecessary: pending foot comments are emitted after }, and head/tail comments always start on a new line. This makes flow mappings consistent with flow sequences, which already only emit the trailing comma in canonical mode.

Also fixes google/yamlfmt#110 and google/yamlfmt#195.

@ccoVeille

ccoVeille commented Aug 30, 2026

Copy link
Copy Markdown

Hi @Fidelxyz

I'm one of the maintainer of yaml/go-yaml a fork maintained by YAML organization & community to replace the discontinued go-yaml/yaml repository that was used to create braydonk/yaml

The v3 branch of yaml/go-yaml is a pure fork of go-yaml/yaml.

I'm curious if you could confirm if the bug you faced here also affects yaml/go-yaml if so we will create a fix in the main branch (the current v4)

cc @ingydotnet

@Fidelxyz

Copy link
Copy Markdown
Author

@ccoVeille I conform that the bug also affects yaml/go-yaml.

@ccoVeille

Copy link
Copy Markdown

@Fidelxyz do you think you cool open an issue on https://github.com/yaml/go-yaml then?

While I understand there is an issue, I don't get what how to replicate the issue out of yamlfmt

Also, I can see @sidsri14 opened

google/yamlfmt#323

He might be interested.

@ccoVeille

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Superfluous comma in flow style

2 participants