In the declaration func (r Thing) Name(variable aType) otherType
, the various things are (in order):
func
is the “this is a function” keyword(r Thing)
indicates “this is a method on the type Thing
, the value the method is invoked on will be in the variable r
” (normal functions do not have a receiver; methods always have exactly one receiver).Name
is the name of the method(variable aType)
is an argument list, in this case a single argument, of the type aType
. It is perfectly valid to have zero arguments to a method.otherType
is the return type, this can be omitted, if no useful return value exists.