]> Cypherpunks repositories - gostls13.git/commitdiff
gob: update documentation about wire format for interfaces.
authorRob Pike <r@golang.org>
Sun, 31 Oct 2010 22:08:45 +0000 (15:08 -0700)
committerRob Pike <r@golang.org>
Sun, 31 Oct 2010 22:08:45 +0000 (15:08 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/2814041

src/pkg/gob/doc.go

index 60909fa0c038675c58062d1e49ccf237c08d8778..81e3029ac29793e6368a0e51734f6d86cfb9f11f 100644 (file)
@@ -130,11 +130,12 @@ Interface types are not checked for compatibility; all interface types are
 treated, for transmission, as members of a single "interface" type, analogous to
 int or []byte - in effect they're all treated as interface{}.  Interface values
 are transmitted as a string identifying the concrete type being sent (a name
-that must be pre-defined by calling Register()), followed by the usual encoding
-of concrete (dynamic) value stored in the interface value.  (A nil interface
-value is identified by the empty string and transmits no value.) Upon receipt,
-the decoder verifies that the unpacked concrete item satisfies the interface of
-the receiving variable.
+that must be pre-defined by calling Register), followed by a byte count of the
+length of the following data (so the value can be skipped if it cannot be
+stored), followed by the usual encoding of concrete (dynamic) value stored in
+the interface value.  (A nil interface value is identified by the empty string
+and transmits a zero-length value.) Upon receipt, the decoder verifies that the
+unpacked concrete item satisfies the interface of the receiving variable.
 
 The representation of types is described below.  When a type is defined on a given
 connection between an Encoder and Decoder, it is assigned a signed integer type