Pointer receiver
A pointer receiver is a method receiver whose parameter is a pointer to a value, allowing the method to access or modify that value.
100 Go Mistakes and How to Avoid Them
A pointer receiver is a Go method receiver declared as a pointer, so the method can observe or modify the value referenced by that pointer.
- How it is used
- Guides method receiver choice when mutation, copying, object size, or later observation of state matters.
- How deep it goes
- Explains copied pointers, mutation, nil receivers, and deferred receiver evaluation; defers thorough values-versus-pointers performance treatment.
- Examples
- Contrasts balance updates of 100 versus 150, a nil pointer returned as an error, and deferred prints of `foo` versus `bar`.
- What you can do after
- Diagnose/debug with it when a method fails to mutate its receiver or a deferred call observes an unexpected value.
Read how 100 Go Mistakes and How to Avoid Them explains pointer receiver →
Learn Go with Pocket-Sized Projects
A pointer receiver is a method receiver whose parameter points to the receiver value, allowing method operations to access the original value.
- How it is used
- Attaches behavior to a struct while allowing method operations to work through the original value.
- How deep it goes
- Defines receiver syntax, demonstrates invocation, and gives consistency guidance without detailing method-set internals.
- Examples
- Uses a terminal word game’s `Game.Play` method and a currency converter’s `Decimal.String` implementation.
- What you can do after
- Build it from scratch by declaring pointer-receiver methods and calling them on constructor-returned pointers.
Read how Learn Go with Pocket-Sized Projects explains pointer receiver →
Related concepts
- value receivercontrasts with · A value receiver is a method receiver declared as a non-pointer value, causing the method to operate on a copy of the receiver.
- receiverkind of · A receiver is an entity that accepts a message or signal, or an object on which a method or command operates.
- referenceuses · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
- io.Writercontrasts with · io.Writer is a Go interface whose Write method accepts a byte sequence and returns the number of bytes written and any error.
- methoduses · A method is a callable operation associated with an object or type and invoked through that association.
- missing valueused by · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

