▲ | hackerbrother 4 days ago | |||||||||||||
Along these lines, Go eliminates many formatting decisions at the syntax level. E.g.,
is not just non-standard formatting, but illegal Go syntax. Similarly, extra parentheses around if clauses are not allowed. | ||||||||||||||
▲ | TheDong 4 days ago | parent [-] | |||||||||||||
> Similarly, extra parentheses around if clauses are not allowed. However 'if (x) == (1) {}' is totally fine with the formatter. As is an assignment of '(x) = (y)'. It's actively annoying too because like, extra parenthesis often have important meaning. For example, consider the following code:
In that case, the code is obviously temporarily commented out, but go's formatting will make it so that if you comment it out like that, fmt, and then uncomment it and forget to re-add the parens, you get shot in the foot.I've hit that far more times than it's uhh... I dunno, I guess removed parenthesis I didn't want? I don't write them if I don't want them. | ||||||||||||||
|