复制后,原始对象仍在修改中

In the following code why is the value of n being modified? (playground link)

package main

import (
    "fmt"
    "math/big"
)

func main() {
    n := big.NewInt(5)
    nCopy := new(big.Int)
    *nCopy = *n

    // The values of "n" and "nCopy" are expected to be the same.
    fmt.Println(n.String(), nCopy.String(), &n, &nCopy)

    nCopy.Mod(nCopy, big.NewInt(2))

    // The values of "n" and "nCopy", I would think, should be different.
    fmt.Println(n.String(), nCopy.String(), &n, &nCopy)
}

Reading this answer seems to say that the third line in my example's main() should make a copy of the contents of n. The addresses of the two variables which are output in the two Println statements also seem to show that the two big.Ints are stored in separate memory locations.

I realize that instead of using *nCopy = *n I could use nCopy.Set(n) and my final Println would display what I expect it to. But I am curious why *nCopy = *n seems to retain a "link" between the two pointers.

An Int is a struct with a nat field. A nat is a slice.

When you copy the Int, the original and copy share the backing array for the nat. Modifications through one Int to the backing array are visible to the other Int.

Assignment is not a deep copy. Assignment of a struct value is equivalent to assigning the fields in the struct individually. Assignment of a slice does not copy the backing array.