To let a function modify the original value, pass a pointer. The pointer itself is copied, but it still points to the same memory:
func double(n *int) {
*n = *n * 2 // modifies original
}
x := 5
double(&x)
// x is now 10
Use &x to get a pointer to x. Inside the function, *n accesses the value the pointer points to. Now changes persist after the function returns.