cmd/gofmt: does not remove empty line right after open brace #28691
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In all code examples and documentation in go, there is no empty line right after open brace in start of a function, or a loop, or similar.
Gofmt seems to not enforce this, though, and there are members of my team that insist that if gofmt isn't changing it, then it's official stance of go language, since it does remove it in struct declaration.
I'm opening this issue to seek clarification and if there's any official stance from @ianlancetaylor on empty lines after opening brace, and, hopefully, add enforcing of that into gofmt, since it already does that to structs.
For example here
gofmt
will remove the first empty line:But here
gofmt
will not:More examples that can be gofmt'ed are at this link -- https://play.golang.org/p/FkD7WAOU-uL
What did you expect to see?
Empty lines after opening brace removed, as it's being done with struct definitions.
What did you see instead?
Only struct definition gets empty line removed after opening brace.
The text was updated successfully, but these errors were encountered: