summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/gob/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/encoding/gob/doc.go')
-rw-r--r--src/pkg/encoding/gob/doc.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pkg/encoding/gob/doc.go b/src/pkg/encoding/gob/doc.go
index 821d9a3fe..5bd61b12e 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.
@@ -118,7 +120,7 @@ elements using the standard gob encoding for their type, recursively.
Maps are sent as an unsigned count followed by that many key, element
pairs. Empty but non-nil maps are sent, so if the sender has allocated
-a map, the receiver will allocate a map even no elements are
+a map, the receiver will allocate a map even if no elements are
transmitted.
Structs are sent as a sequence of (field number, field value) pairs. The field
@@ -328,7 +330,7 @@ reserved).
01 // Add 1 to get field number 0: field[1].name
01 // 1 byte
59 // structType.field[1].name = "Y"
- 01 // Add 1 to get field number 1: field[0].id
+ 01 // Add 1 to get field number 1: field[1].id
04 // struct.Type.field[1].typeId is 2 (signed int).
00 // End of structType.field[1]; end of structType.field.
00 // end of wireType.structType structure