address operator

The & operator in Go, which takes the memory address of a variable and gives you a pointer to it.

In more detail

addTag(&status) passes a pointer to status so the function can change it. You can also write &Target{...} to create a value and get a pointer to it in one step. Only addressable values, such as variables and struct fields, can have their address taken.

Example

addTag(&status)

Related terms

Taught in

References