logoalt Hacker News

verdvermlast Thursday at 5:26 AM1 replyview on HN

go fmt already changes one-liner if statements to be multi-line

you are proposing changing this, making code look different based on differences of opinions between developers

go fmt is actually one of the top rated features of Go, it makes everyone's code look the same, everyone has nitpicks about it, yet by and large it is one of the most loved things about Go. Breaking this is even less likely than changing error handling


Replies

bccdeelast Thursday at 12:49 PM

The code already looks different based on different developers' opinions. Gofmt already allows this:

    fmt.Printf("%s %s %s %s\n", arg1, arg2, arg3, arg4)
and this

    fmt.Printf("%s %s %s %s\n",
        arg1, arg2, arg3, arg4)
and this

    fmt.Printf(
        "%s %s %s %s\n",
        arg1,
        arg2,
        arg3,
        arg4,
    )
and will not alter any of the above. All I want is similar ambiguity around one-line `if` statements. That's not so crazy.