fix typoo

Ian Lance Taylor 2021-03-29 13:44:13 -07:00
parent c66728c4fb
commit ff395424b5

@ -563,7 +563,7 @@ Choosing whether to use a value or pointer receiver on methods can be difficult,
* Can function or methods, either concurrently or when called from this method, be mutating the receiver? A value type creates a copy of the receiver when the method is invoked, so outside updates will not be applied to this receiver. If changes must be visible in the original receiver, the receiver must be a pointer.
* If the receiver is a struct, array or slice and any of its elements is a pointer to something that might be mutating, prefer a pointer receiver, as it will make the intention more clear to the reader.
* If the receiver is a small array or struct that is naturally a value type (for instance, something like the time.Time type), with no mutable fields and no pointers, or is just a simple basic type such as int or string, a value receiver makes sense. A value receiver can reduce the amount of garbage that can be generated; if a value is passed to a value method, an on-stack copy can be used instead of allocating on the heap. (The compiler tries to be smart about avoiding this allocation, but it can't always succeed.) Don't choose a value receiver type for this reason without profiling first.
* Don't mix reciever types. Choose either pointers or struct types for all available methods.
* Don't mix receiver types. Choose either pointers or struct types for all available methods.
* Finally, when in doubt, use a pointer receiver.
## Synchronous Functions