method receiver

The special first parameter of a Go method, written before the method name, that is the value the method is called on.

In more detail

In func (t Target) Address(), t is the receiver. A value receiver works on a copy, so it suits read-only methods; a pointer receiver works on the original. Keep one style per type so its method set stays predictable.

Example

func (t Target) Address() string

Related terms

Taught in

References