]> Cypherpunks repositories - gostls13.git/commit
encoding/gob: document behavior of zero-valued arrays, slices, and maps
authorRob Pike <r@golang.org>
Thu, 3 Dec 2015 21:06:04 +0000 (13:06 -0800)
committerRob Pike <r@golang.org>
Mon, 7 Dec 2015 20:41:31 +0000 (20:41 +0000)
commit148b13c3bb889addae33f3a2e41e8e854351df6c
treed3159eff463a117bdb5409abbca9bf153c6f57f1
parent70da2d0a2a4292cf210f8f8d48129d35ad8c54fb
encoding/gob: document behavior of zero-valued arrays, slices, and maps

The documentation was inconsistent. It said zero values were not sent, but
that zero-valued elements of arrays and arrays were sent. But which rule
applies if the array is all zero elements, and is therefore itself a zero value?

The answer is: the array is transmitted. In principle the other choice could
be made, but there would be considerable expense and complexity required
to implement this behavior now, not to mention worries about changes of
behavior.

Therefore we just document the situation: Arrays, slices, and maps are
always encoded. It would perhaps be nice to have sorted this out earlier,
but it was a missed opportunity.

Fixes #13378

Change-Id: I8fae345edfa707fcfa7a3e0160d87ff1ac5cc5a2
Reviewed-on: https://go-review.googlesource.com/17394
Reviewed-by: Russ Cox <rsc@golang.org>
src/encoding/gob/doc.go