-
-
Notifications
You must be signed in to change notification settings - Fork 125
Description
I'd love it if gofumpt was more opinionated about function signatures. The only ones that should be allowed are these two formats imo:
short
func shortFunc(ctx context.Context, someInt int, someBool bool, someString string) (bool, error) {
...
}long
If the function signature is very long such that it would go past the line length limit then something like this should be emitted:
func longFunc(
ctx context.Context,
someInt int,
someBool bool,
someString string,
) (bool, error) {
...
}ugly
but if I have an ugly mix of these, gofumpt does not fix it:
func uglyFunc(ctx context.Context,
someInt int,
someBool bool, someString string,
) (bool, error) {
...
}If you don't like the format of the short or long ones above, change them as you see fit! The main thing is gofumpt ought to emit some standard and not allow an ugly mess like above.
If the return value signature is very long maybe split that up across lines also. e.g. if the function was returning 100 bools and an error instead of just (bool, error). Of course that's a poorly designed function but the linter should still fix it so it's more readable.