I have a parent object that holds two pointers to child objects:
type parent struct {
c1, c2 *child
}
type child struct {
val string
}
Then depending on whether I set both parent pointers to the same object or to two identical objects, I get different hashes:
c1 := child{val: "child"}
c2 := child{val: "child"}
p1 := parent{c1: &c1, c2: &c1}
p2 := parent{c1: &c1, c2: &c2}
ph1 := Hash(p1)
ph2 := Hash(p2)
// ph1 != ph2
This is the simplest form of the problem I'm seeing. When I saw this with functioning code, the object graph was quite a bit more complicated.
I have a parent object that holds two pointers to child objects:
Then depending on whether I set both parent pointers to the same object or to two identical objects, I get different hashes:
This is the simplest form of the problem I'm seeing. When I saw this with functioning code, the object graph was quite a bit more complicated.