Please answer these questions before submitting your issue. Thanks!
go version)?Should apply to any version of go.
Yep. It's a formatting enhancement.
go env)?Should happen in any environment.
Type the following and run it through gofmt:
a.b.c = 123
a.d = "def"
a.e.f.g = 456
h, i = 7, 8
j := 123
k.l := "def"
k.m.n.o := 456
p, q := 7, 8
var r = "abc"
var t, u = 1, 2
var v int = 3
and nothing would change with the formatting
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:
a.b.c = 123
a.d = "def"
a.e.f.g = 456
h, i = 7, 8
j := 123
k.l := "def"
k.m.n.o := 456
p, q := 7, 8
var r = "abc"
var t, u = 1, 2
var v int = 3
Saw the original code.
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--u and int do not vertically overlap.
This would be really nice to have.
PS: I've just realized that I've already commented on this issue: bradfitz deleted a comment from sylr 22 days ago. @bradfitz would you be kind enough to tell me why you removed my comment.
@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 ?
Most helpful comment
Note that inside a factored var block, this already happens:
Note also that the formatting here differs slightly from your suggested formatting--
uandintdo not vertically overlap.