Skip to content

cmd/gofmt: inconsistent formatting of empty methods #28082

@neild

Description

@neild

What version of Go are you using (go version)?

go version go1.11rc2 linux/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

Format https://play.golang.org/p/VW-uvEb5Mro

package main

func main(                                                                                                      ) {}

What did you expect to see?

https://play.golang.org/p/34L1Aw0cZ1D

package main

func main() {}

What did you see instead?

package main

func main() {
}

Looks like gofmt is deciding whether to turn {} into {\n} based on the original length of the line, rather than the post-formatting length. This is harmless, but surprising.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions