Go: Should I Use a Pointer instead of a Copy of my Struct?

Vincent Blanchon
May 12, 2019 · 5 min read
Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.

For many Go developers, the systematic use of pointers to share structs instead of the copy itself seems the best option in terms of performance.

In order to understand the impact of using a pointer rather than a copy of the struct, we will review two use cases.

Intensive allocation of data