Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/gofmt: Slice literal condensed to one line and comment moved outside if comment is last line #18599
Perhaps a duplicate of #9460, but the issue discussion says it's restricted to
What version of Go are you using (
I've spent some time on this today, and it's more complicated than I hoped for. The problem seems to appear when a composite literal could be written on a single line, were it not for the comments.
gofmt does what you'd expect. In other words, if you end up commenting out individual lines anyway (and write them on a separate line), don't put the initial elements on the line with the opening
(And if you started out with a single line
Pushing to Go1.10 since there's a perfectly sensible formatting style that avoids the issue.