-
Notifications
You must be signed in to change notification settings - Fork 62
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
Comments
Good question! |
Yes, I would like that, too: either all arguments on one line XOR one line per argument with first arg being on a new line. |
@ixje are you sure that it is broken? This works fine: package main
func foo(loooooooongname1 string, loooooooongint1 int, loooooooongname2 string, loooooooongint2 int) {
return
}
func main() {
foo("a", 1, "b", 2)
} output: ❯ golines tmp/t/main.go
package main
func foo(
loooooooongname1 string,
loooooooongint1 int,
loooooooongname2 string,
loooooooongint2 int,
) {
return
}
func main() {
foo("a", 1, "b", 2)
} |
@guettli for your example sure, but that was not what I tried pointing out This has a length of 98 func foo(loooooooongname1 string, loooooooongint1 int, loooooooongname2 string, looongint2 int) {
return
} but could have been written as this (let's ignore how we might have gotten to such format) func foo(
loooooooongname1 string, loooooooongint1 int, loooooooongname2 string, looongint2 int,
) {
return
} Now golines doesn't format it $ golines golines.go
package main
func foo(
loooooooongname1 string, loooooooongint1 int, loooooooongname2 string, looongint2 int,
) {
return
}
func main() {
foo("a", 1, "b", 2)
} I think it ideally should be formatted as the first snippet, because it fits in that length. |
Let's assume the following function exceeds the maximum line-length
golines will then reformat it to
This suggests to me there should be at most 2 function signature styles
However, if we take something like this
or this
golines will not format the function signature. Is this expected behaviour or should it actually format it using the multi-line params approach?
The text was updated successfully, but these errors were encountered: