Skip to content

cmd/gofmt: remove leading/trailing blank lines from function bodies #6996

@josharian

Description

@josharian
What steps will reproduce the problem?

1. http://play.golang.org/p/Np4vGQFcqA
2. Hit Format.


What is the expected output? What do you see instead?

Want: Lines 6 and 13 removed.
Have: No change.


Please use labels and text to provide additional information.

Discussed with the community in
https://groups.google.com/forum/#!topic/golang-nuts/Z_s_tLTazJU

Based on that feedback, I propose that gofmt:

* remove trailing blank lines from function bodies
* remove leading blank lines when the function declaration is a single line

If this (or some variant thereof) gets an official blessing, I'd be happy to implement.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions