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

Agreed, something about putting the second condition on the next line right next to the if body irks me a bit

prettier turns this:

if (isThisAReallyLongVariableName === 123 && doReallyLongNamedCheck() === true) {
  return true

into this:

if (
  isThisAReallyLongVariableName === 123 &&
  doReallyLongNamedCheck() === true
) {
  return true;

which works for me, but only because of the way the parens are used here, which is optional and completely uncommon in Go code


Related questions

No questions were found.
Ron Waldon jokeyrhyme @atlassian Gosford, NSW, Australia gay, male, cisgender, husband, Beagle chew-toy, JavaScript jockey, Apple / Google apologist
Github User Rank List