Skip to content

force multiline function signatures to separate the body #73

@mvdan

Description

@mvdan

That is, turn

func VeryLong(param1 T1, param2 T2, [...],
    param6 T6, param7 T7) {
    doWork(...)
}

into the more readable:

func VeryLong(param1 T1, param2 T2, [...],
    param6 T6, param7 T7,
) {
    doWork(...)
}

This is important to properly separate the parameter list from the function body, since in the first case they share the same indentation level.

I've seen an empty line be used for this too, as seen below, but it takes the same amount of lines and it's less clear and consistent:

func VeryLong(param1 T1, param2 T2, [...],
    param6 T6, param7 T7) {

    doWork(...)
}

This rule could be made stronger in the future, such as enforcing parameters to all be on separate lines, but I don't want to go that far right now. I assume most Go developers would not have an issue with this smaller change.

cc @twpayne @rogpeppe @kovetskiy @Southclaws @geoah for input

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions