You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See http://play.golang.org/p/0drzUw8O6w. The pointer-to-one gets turned into a
pointer-to-one, but the the pointer-to-zero gets turned into a nil pointer.
The text was updated successfully, but these errors were encountered:
I'm not sure this is even considered a bug; I think this is how gobs are supposed to
work. Per http://golang.org/pkg/encoding/gob/, pointers are flattened, so encoding
struct{x *int}{&0} (using "&0" as a notation for pointer to an int with value zero) is
intended to be equivalent to encoding struct{x int}{0}, which is specified to not be
explicitly encoded.
It's a shame that this means that encoding/gob can't preserve things like protocol
buffers, but that's just the way it is. The workaround there is to encode the proto
yourself, and encode []byte via gobs instead.
The text was updated successfully, but these errors were encountered: