Ask questionsbreak long lines when it's appropriate to do so
Howdie, love your work, and just stumbled across this which also looks awesome :)
I use prettier with JavaScript, and cargo fmt with Rust, and they both automatically (and consistently) break up long lines
Example func:
func somethingTooLong(ctx context.Context, longArgument string, anotherOne func(time.Duration) bool) (int, error) {
// foo
}
func somethingTooLong(
ctx context.Context,
longArgument string,
anotherOne func(time.Duration) bool
) (int, error) {
// foo
}
gofmt doesn't do this, but it also doesn't undo it where I've done this manually, so at least this particular example is gofmt-compatible
Answer
questions
jokeyrhyme
Another example, this time in rustfmt (Rust is like Go in that if conditions do not require parens):
if isThisAReallyReallyReallyReallyReallyLongVariableName == 123 && doReallyReallyReallyLongNamedCheck() == true {
return true;
}
becomes:
if isThisAReallyReallyReallyReallyReallyLongVariableName == 123
&& doReallyReallyReallyLongNamedCheck() == true
{
return true;
}
Related questions
No questions were found.