godoc: don't convert multi-line functions into one-liners by default
- new heuristic: if both the opening { and closing } braces are on the
same line, and the function body doesn't contain comments or is other-
wise too long (e.g. signature too long), it is formatted as a one-line
function
- related cleanups along the way
- gofmt -w src misc led to no additional changes as expected
http://codereview.appspot.com/758041/diff/10001/11005 File src/pkg/go/printer/testdata/declarations.golden (right): http://codereview.appspot.com/758041/diff/10001/11005#newcode359 src/pkg/go/printer/testdata/declarations.golden:359: type _ struct { /* this comment should be ...
On Thu, Mar 25, 2010 at 2:03 PM, <rsc@google.com> wrote:
>
> http://codereview.appspot.com/758041/diff/10001/11005
> File src/pkg/go/printer/testdata/declarations.golden (right):
>
> http://codereview.appspot.com/758041/diff/10001/11005#newcode359
> src/pkg/go/printer/testdata/declarations.golden:359: type _ struct { /*
> this comment should be visible */
> Is it possible to leave this as is (with the brace where it was?).
>
I tried to not change this, but it involves more machinery than I thought
worthwhile. This is a side-effect of fixing another problem where a closing
} is not moved to the next line. I decided it's more important to reformat
{ statement
statement /* comment */ }
to
{ statement
statement /* comment */
}
than preserving
{ /* comment *}
If you feel strongly about it, I'll spend some more time on it. I don't know
that this kind of code is showing up a whole lot in the source.
- Robert
>
> http://codereview.appspot.com/758041/show
>
*** Submitted as http://code.google.com/p/go/source/detail?r=1e6a28abcdf4 ***
godoc: don't convert multi-line functions into one-liners by default
- new heuristic: if both the opening { and closing } braces are on the
same line, and the function body doesn't contain comments or is other-
wise too long (e.g. signature too long), it is formatted as a one-line
function
- related cleanups along the way
- gofmt -w src misc led to no additional changes as expected
R=rsc, rsc1
CC=golang-dev, ken2, r
http://codereview.appspot.com/758041
Issue 758041: code review 758041: godoc: don't convert multi-line functions into one-line...
(Closed)
Created 16 years ago by gri
Modified 16 years ago
Reviewers:
Base URL:
Comments: 1