Source: https://golang.org/src/encoding/gob/encode.go
Timestamp: 2019-04-24 18:01:37+00:00

Document:
22  // encoderState is the global execution state of an instance of the encoder.
25  // 0 terminates the structure.
30  	fieldnum int                  // the last field number written.
31  	buf      [1 + uint64Size]byte // buffer used by the encoder; here to avoid allocation.
35  // encBuffer is an extremely simple, fast implementation of a write-only byte buffer.
36  // It never returns a non-nil error, but Write returns an error value so it matches io.Writer.
102  // than 128 (0 through 0x7F), its value is written directly.
104  // by the byte length, negated.
106  // encodeUint writes an encoded unsigned integer to state.b.
120  // encodeInt writes an encoded signed integer to state.w.
122  // uint to recover the int.
133  // encOp is the signature of an encoding operator for a given type.
144  // update emits a field number and updates the state to record its value for delta encoding.
154  // indirections associated with the elements of the data structure.
157  // strings etc. - are indirected before calling their encoders.
162  // encIndirect dereferences pv indir times and returns the result.
173  // encBool encodes the bool referenced by v as an unsigned 0 or 1.
186  // encInt encodes the signed integer (int int8 int16 int32 int64) referenced by v.
195  // encUint encodes the unsigned integer (uint uint8 uint16 uint32 uint64 uintptr) referenced by v.
204  // floatBits returns a uint64 holding the bits of a floating-point number.
215  // encFloat encodes the floating point value (float32 float64) referenced by v.
225  // encComplex encodes the complex value (complex64 complex128) referenced by v.
226  // Complex numbers are just a pair of floating-point numbers, real part first.
238  // encUint8Array encodes the byte array referenced by v.
239  // Byte arrays are encoded as an unsigned count followed by the raw bytes.
249  // encString encodes the string referenced by v.
250  // Strings are encoded as an unsigned count followed by the raw bytes.
261  // as delta field number of 0.
269  // data, typically a struct. It is executed top to bottom, walking the struct.
276  // valid reports whether the value is valid and a non-nil pointer.
288  // encodeSingle encodes a single top-level non-struct value.
294  	// generate data even if the item is zero. To do this, set sendZero.
305  // encodeStruct encodes a single struct value.
323  			// TODO: Is field guaranteed valid? If so we could avoid this check.
332  // encodeArray encodes an array.
346  			// TODO: Is elem guaranteed valid? If so we could avoid this check.
355  // encodeReflectValue is a helper for maps. It encodes the value v.
366  // encodeMap encodes a map as unsigned count followed by key:value pairs.
380  // encodeInterface encodes the interface value iv.
384  // followed by no value.
387  	// values holding nil pointers, since nil pointers point to no value.
407  	// Send the name.
410  	// Define the type id if necessary.
412  	// Send the type id.
415  	// should be written to b, before the encoded value.
433  // isZero reports whether the value is the zero of its type.
468  // encGobEncoder encodes a value that implements the GobEncoder interface.
469  // The data is sent as a byte array.
471  	// TODO: should we catch panics from the called method?
475  	// We know it's one of these.
515  // the indirection count to reach it.
518  	// If the type implements GobEncoder, we handle it without further processing.
522  	// If this type is already in progress, it's a recursive type (e.g. map[string]*T).
523  	// Return the pointer to the op we're already building.
543  			// Slices have a header; we decode it to find the underlying array.
554  			// True arrays have size in the type.
574  			// Generate a closure that calls out to the engine for the nested type.
599  // gobEncodeOpFor returns the op for a type that is known to implement GobEncoder.
612  			// Need to climb up one level to turn value into pointer.
624  	return &op, int(ut.encIndir) // encIndir: op will get called with p == address of receiver.
627  // compileEnc returns the engine to compile the type.
658  // getEncEngine returns the engine to compile the type.
672  	// Check for recursive types.

References: v.

 v.

 v.

 v.

 v.

 v.

 v.