The documentation states that *Key is immutable, but what prevents somebody
from writing this:
key := newKey(context, "Entity", "", 123, nil)
....
*key = *someOtherKey // The key referenced by 'key' has now changed
violating immutability.
...
*key = Key{}
Even more grievous, would be this.
parentKey := newKey(context, "Parent", "", 456, nil)
key := newKey(context, "Entity", "", 123, parentKey)
*parentKey = *someOtherKey // Also modifies the key that 'key' references
as a side effect!
In my experience raw reference types in go such as pointers, slices, or
maps can make no guarantees regarding immutability.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/HJTW6OpGKNEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.