-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
gofmt uses spacing to group operands/operators with the same precedence to show order e.g. "a+b | c". At the same time, it avoids the grouping if parentheses are being used, e.g. "(a + b) | c". One place, where this doesn't work as expected, however, is in function calls (and by extension type conversions). gofmt produces the following output: "foo(a+b) | c", even though "a + b" is already grouped by parentheses. While this might be okay generally, it produces very unreadable output when working with bit masks. E.g. "foo(someVariable&someBitmask) | c" is hard to read and especially hard to recognize as a bitwise operation from a distance. My request is to either generally accept that function calls already group the operands, so that there is no need to group them with the lack of spacing, or to add special treating for &, &&, | and || because they do not read well without spacing.