-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: extend column alignment to include assignments and declarations #23495
Comments
gofmt isn't soliciting change requests at this time, but I'll keep this open on the back burner ("Unplanned") in any case. Maybe @griesemer will consider a batch of them at some point in the future. |
Note that inside a factored var block, this already happens: var (
r = "abc"
t, u = 1, 2
v int = 3
) Note also that the formatting here differs slightly from your suggested formatting-- |
This would be really nice to have. PS: I've just realized that I've already commented on this issue: |
@sylr, +1's are useless comments. Your comment provided no value for the issue and it was removed, per https://github.com/golang/go/wiki/NoMeToo |
Well, "useless" and "no value" might be a little harsh, but yes: we enforce our NoMeToo policy to make bug threads more readable. |
Fair enough. However, due to a less than perfect Github issue search engine, you can't list the issues you have subscribed to and commenting is, to my knowledge, the only way to be able to search for issues you have interest for at a later time. In the case of this particular issue which I don't have meaningful things to add, commenting "+1" or "This would be really nice to have." was, besides hoping to increase traction on this issue, mainly intended for me to be able to look for it in the search engine. But I do understand if everyone does it it becomes unbearable. |
Could this be planned for go2 ? |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Should apply to any version of go.
Does this issue reproduce with the latest release?
Yep. It's a formatting enhancement.
What operating system and processor architecture are you using (
go env
)?Should happen in any environment.
What did you do?
Type the following and run it through gofmt:
and nothing would change with the formatting
What did you expect to see?
I would like to see are the same rules gofmt currently applies to structs and maps to be more uniformly applied. Specifically to sequential assignments, sequential declarations with := and sequential declaration withs =.
So I'd like to see:
What did you see instead?
Saw the original code.
The text was updated successfully, but these errors were encountered: