From: Russ Cox Date: Sat, 22 Dec 2012 15:43:47 +0000 (-0500) Subject: encoding/gob: document that structs only encode/decode exported fields X-Git-Tag: go1.1rc2~1561 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d324c4af87f0c2e41f2822438594d39c90bb0fba;p=gostls13.git encoding/gob: document that structs only encode/decode exported fields Fixes #4579. R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/7000051 --- diff --git a/src/pkg/encoding/gob/doc.go b/src/pkg/encoding/gob/doc.go index 8b6fcfb4c8..5bd61b12eb 100644 --- a/src/pkg/encoding/gob/doc.go +++ b/src/pkg/encoding/gob/doc.go @@ -67,11 +67,13 @@ point values may be received into any floating point variable. However, the destination variable must be able to represent the value or the decode operation will fail. -Structs, arrays and slices are also supported. Strings and arrays of bytes are -supported with a special, efficient representation (see below). When a slice is -decoded, if the existing slice has capacity the slice will be extended in place; -if not, a new array is allocated. Regardless, the length of the resulting slice -reports the number of elements decoded. +Structs, arrays and slices are also supported. Structs encode and +decode only exported fields. Strings and arrays of bytes are supported +with a special, efficient representation (see below). When a slice +is decoded, if the existing slice has capacity the slice will be +extended in place; if not, a new array is allocated. Regardless, +the length of the resulting slice reports the number of elements +decoded. Functions and channels cannot be sent in a gob. Attempting to encode a value that contains one will fail.