Nested expressions where the spacing around operators suggests a different grouping than that imposed by the Go operator precedence rules are problematic: they could indicate a bug where the author of the code misunderstood the precedence rules. Even if there is no a bug, the spacing could be confusing to people who read the code.
Make sure that the spacing around operators reflects operator precedence, or use parentheses to clarify grouping.
Consider the following function intended for checking whether the bit at position `pos` of the variable `x` is set:
Here, the spacing around
<< suggests the grouping
x & (1<<pos). However, in Go
the same precedence and hence are evaluated left to right, so the expression is actually equivalent to
(x & 1) << pos.
To fix this issue and give the expression its intended semantics, parentheses should be used like this: