Equality

There are different ways to compare things in Go, none of them is perfect.

Operators == and !=

The equality operator is the simplest and often most efficient way to compare things in Go, but it only works on certain things. Most notably it doesn’t work on slices or maps. Slices and maps can only be compared to nil this way.

Get hands-on with 1400+ tech skills courses.