Skip to content

Should function signature formatting be applied to this? #145

@ixje

Description

@ixje

Let's assume the following function exceeds the maximum line-length

func foo(name1 string, name2 string, name3 bool, name4 []byte) (*[]byte, error) {
	return nil, nil
}

golines will then reformat it to

func boo(
	name1 string,
	name2 string,
	name3 bool,
	name4 []byte,
) (*[]byte, error) {
	return nil, nil
}

This suggests to me there should be at most 2 function signature styles

  1. single line (if within max line length)
  2. multi-line with each param on a separate line (if exceeding max line length)

However, if we take something like this

func foo(
    name1 string, name2 string, name3 bool, name4 []byte
) (*[]byte, error) {
	return nil, nil
}

or this

func foo(name1 string, name2 string, name3 bool, 
    name4 []byte) (*[]byte, error) {
	return nil, nil
}

golines will not format the function signature. Is this expected behaviour or should it actually format it using the multi-line params approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions