Back to course

Pointers: Don't Be Afraid

Go (Golang) for Cloud-Native Microservices

Pointers in Go

Go has pointers, but no pointer arithmetic (so it's safer than C).

  • &: Address-of operator (gets the memory address).
  • *: Dereference operator (gets the value at the address).

Why use pointers?

To modify a value in-place without copying large structs in memory. In microservices, pointers are essential for sharing state efficiently.