-
Prefer value parameters. Use a pointer parameter only when the function must mutate the caller’s value, the type must not be copied, or a struct is genuinely large.
-
If you must optimize performance, always measure before switching to a pointer return value. For small data, returning a value is usually faster.
-
Maps make bad parameters and return values—not only because they aren’t self-documenting, but because they are always mutable. Prefer a struct unless you don’t know the keys at compile time.
-
Document when a function modifies the contents of a slice argument.
Progress is saved on this device.