• Rob Pike's avatar
    encoding/gob: document behavior of zero-valued arrays, slices, and maps · 148b13c3
    Rob Pike authored
    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/17394Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    148b13c3
Name
Last commit
Last update
..
codec_test.go Loading commit data...
debug.go Loading commit data...
dec_helpers.go Loading commit data...
decgen.go Loading commit data...
decode.go Loading commit data...
decoder.go Loading commit data...
doc.go Loading commit data...
dump.go Loading commit data...
enc_helpers.go Loading commit data...
encgen.go Loading commit data...
encode.go Loading commit data...
encoder.go Loading commit data...
encoder_test.go Loading commit data...
error.go Loading commit data...
example_encdec_test.go Loading commit data...
example_interface_test.go Loading commit data...
example_test.go Loading commit data...
gobencdec_test.go Loading commit data...
timing_test.go Loading commit data...
type.go Loading commit data...
type_test.go Loading commit data...