Go does not have classes and objects, but it does have types that we
can make many instances of. Further, we can attach methods to these
types and they kind-of start looking like the classes we’re used
to. When we attach a method to a type, the receiver is the instance
of the type for which it was called.
Choosing the name of a receiver is not always a trivial task. Should
we be lazy and name them all the same (like this
or self
)? Or
treat them not unlike local variables by abbreviating the type (like
srv
to a Server
type )? Or maybe something even more nuanced?
And what are the consequences? How will our code suffer if we choose
one approach over the other? Let's explore.