Skip to content

cmd/gofmt: puts else if comments in wrong place #20562

@purpleidea

Description

@purpleidea

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

play.golang.org

What operating system and processor architecture are you using (go env)?

play.golang.org

What did you do?

Ran this: https://play.golang.org/p/xJ0-Cq8ZYi and clicked format

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
here it is: https://play.golang.org/p/xJ0-Cq8ZYi

What did you expect to see?

I expected the B and C branch comments to be aligned the same way the A branch comment is..

What did you see instead?

Instead they were indented as if they were part of the previous block.

I get how this is a tricky issue, but if there is a blank line and the comment is right before the next block, I think it should be indented for that block.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions