-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/gofmt: incorrect indentation of comments for LabeledStmt #27964
Comments
Curious to know - did you encounter this in a real-world code ? |
No, not real-world code. I'm analysing all the positions that gofmt allows comments to be attached to the AST - see: https://github.com/dave/dst/blob/remove-doc-comment/gendst/postests/position-tests.go#L112-L115 |
I see. |
Yup agreed - unlikely to come up in normal use, but it's the only formatting anomaly I've found yet, so I thought I'd mention it. I certainly wouldn't be too upset if this didn't get fixed. |
It shouldn't be too hard to break alignment before a label. Assigning to myself so it stays in my radar but unlikely to get addressed anytime soon. Not important. Thanks for reporting this irregularity. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
If a LabeledStmt has an inline comment before and after the
Colon
, then an inline comment on the previous line will be indented incorrectly:https://play.golang.org/p/mSDEYsc_34O
This code should not change with gofmt:
... however it changes to:
The text was updated successfully, but these errors were encountered: