Go Operator Precedence Table

Go operator precedence determines the order of evaluation for expressions, with multiplication and shifts binding tighter than addition and comparisons.

Go does not have a single built-in operator precedence table in its standard library, but the language specification defines a strict hierarchy where multiplication, division, and shifts bind tighter than addition and comparisons. You can verify the binding order of any expression by wrapping sub-expressions in parentheses to force evaluation order, as shown below.

// Precedence: * > + > ==
// 10 + 2 * 3 evaluates to 16, not 36
result := 10 + 2 * 3

// Use parentheses to override default precedence
// (10 + 2) * 3 evaluates to 36
result := (10 + 2) * 3

The full precedence order from highest to lowest is: * / % << >> & &^, then + - | ^, then == != < <= > >=, then &&, and finally ||.