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
mvdan
That's also a good point. Splitting one line into two, when two lines adds ambiguity, is not good. The example I shared would need another extra newline to become non-ambiguous again. I worry that it might be tricky to determine "will the new format look ambiguous", though.
Though I still think the line on its own should be left alone, even if the ambiguity wasn't an issue.
Related questions
No questions were found.