Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should function signature formatting be applied to this? #145

Open
ixje opened this issue Aug 13, 2024 · 1 comment
Open

Should function signature formatting be applied to this? #145

ixje opened this issue Aug 13, 2024 · 1 comment

Comments

@ixje
Copy link

ixje commented Aug 13, 2024

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?

@ccoVeille
Copy link

Good question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants