On Dec 20, 2013 12:58 PM, "Josh Bleecher Snyder" <josh...@gmail.com> wrote:
>
> Hi all,
>
> My formatting OCD makes me want gofmt to remove leading and trailing
> blank lines within a function. For example, in
> http://play.golang.org/p/Np4vGQFcqA, I'd want gofmt to remove lines 6
> and 13.
godoc is trained to respect the existing grouping of statements, perhaps this is a side-effect of that.
i think it can remove the empty lines here.
> Before I go file an issue, though, I wanted to run it by y'all to see
> what I might be missing.
>
> Are there scenarios in which leading or trailing blank lines serve a
> useful semantic role, as interior blank lines can? Are there scenarios
> in which they play an important role in readability?
i cannot think of any. but others might.
I'd prefer not to. Sometimes wrapping function declarations makes it easier to read and the newline helps distinguish the function declaration from the body: http://play.golang.org/p/E2ygXulXeD
In bigger programs, when adding something temporarily, I'll often leave multiple blank lines around a "loud" comment so that I can find it later and remember to do it.
I'd prefer not to. Sometimes wrapping function declarations makes it easier to read and the newline helps distinguish the function declaration from the body: http://play.golang.org/p/E2ygXulXeD