Value receiver
A value receiver is a method receiver declared as a non-pointer value, causing the method to operate on a copy of the receiver.
100 Go Mistakes and How to Avoid Them
A value receiver is a Go method receiver declared as a value, so the method operates on a copy of the receiver value.
- How it is used
- Guides method receiver choice when copying affects mutation, deferred calls, or synchronization.
- How deep it goes
- Traces observable effects of receiver copies through mutation, defer, and mutex use, while leaving detailed pointer-versus-value performance analysis aside.
- Examples
- Contrasts balance updates, deferred printing of `foo` versus `bar`, and a concurrent counter whose copied mutex fails to protect updates.
- What you can do after
- Diagnose/debug with it when a method fails to mutate its original receiver or copying a mutex causes a race.
Read how 100 Go Mistakes and How to Avoid Them explains value receiver →
Learn Go with Pocket-Sized Projects
A value receiver is a method receiver passed as a value, so invoking the method operates on a copy of the receiver.
- How it is used
- Guides receiver selection when defining methods on Go structures.
- How deep it goes
- Explains copying, structure size, consistency, and pointer-field concerns, but defers detailed pointer-field behavior.
- Examples
- Uses the Game type, its mutable state, and its output pointer field to motivate pointer receivers instead.
- What you can do after
- Apply via Go by selecting value receivers for small structures and pointer receivers when mutation or pointer fields make copying unsuitable.
Read how Learn Go with Pocket-Sized Projects explains value receiver →
Go in Action, Second Edition
A value receiver is a method receiver that operates on a copied value of its receiver type rather than on a pointer to that value.
- How it is used
- Uses value receivers for conversion methods that return new Measurement values while implementing a shared interface.
- How deep it goes
- Explains the design rationale and shows conversion implementations, but does not develop broader receiver or pointer semantics.
- Examples
- Demonstrates value receivers through metric and imperial weight and volume conversion methods.
- What you can do after
- Build conversion methods that return new values and satisfy a focused Convertible interface.
Read how Go in Action, Second Edition explains value receiver →
Related concepts
- pointer receivercontrasts with · A pointer receiver is a method receiver whose parameter is a pointer to a value, allowing the method to access or modify that value.
- receiverkind of · A receiver is an entity that accepts a message or signal, or an object on which a method or command operates.
- lockinguses · Locking is a synchronization technique that restricts concurrent access to shared resources or protected operations.
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.


