Skip to content

cmd/gofmt: one-line function broken into several lines #8146

@cloneable

Description

@cloneable
I've got a one-line function which is slightly longer than the ones surrounding it and
gofmt decides to break it up into three lines. I thought Go is not supposed to have a
line length limit and I have written longer lines (not one-line functions) than this in
the past which gofmt left as-is.

http://play.golang.org/p/1HPUqQ4wWc

WANT:
func (a abcdefghijkl) Less(i, j int) bool   { return a.abcde[i].abcdefghijklm <
a.abcde[j].abcdefghijklm }
func (a abcdefghijklm) Less(i, j int) bool  { return a.abcde[i].abcdefghijklm <
a.abcde[j].abcdefghijklm }
func (a abcdefghijklmn) Less(i, j int) bool { return a.abcde[i].abcdefghijklm <
a.abcde[j].abcdefghijklm }

GOT:
func (a abcdefghijkl) Less(i, j int) bool  { return a.abcde[i].abcdefghijklm <
a.abcde[j].abcdefghijklm }
func (a abcdefghijklm) Less(i, j int) bool { return a.abcde[i].abcdefghijklm <
a.abcde[j].abcdefghijklm }
func (a abcdefghijklmn) Less(i, j int) bool {
    return a.abcde[i].abcdefghijklm < a.abcde[j].abcdefghijklm
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions