type Encoder … const maxLength … var spaceForLength … // NewEncoder returns a new encoder that will transmit on the [io.Writer]. func NewEncoder(w io.Writer) *Encoder { … } // writer returns the innermost writer the encoder is using. func (enc *Encoder) writer() io.Writer { … } // pushWriter adds a writer to the encoder. func (enc *Encoder) pushWriter(w io.Writer) { … } // popWriter pops the innermost writer. func (enc *Encoder) popWriter() { … } func (enc *Encoder) setError(err error) { … } // writeMessage sends the data item preceded by an unsigned count of its length. func (enc *Encoder) writeMessage(w io.Writer, b *encBuffer) { … } // sendActualType sends the requested type, without further investigation, unless // it's been sent before. func (enc *Encoder) sendActualType(w io.Writer, state *encoderState, ut *userTypeInfo, actual reflect.Type) (sent bool) { … } // sendType sends the type info to the other side, if necessary. func (enc *Encoder) sendType(w io.Writer, state *encoderState, origt reflect.Type) (sent bool) { … } // Encode transmits the data item represented by the empty interface value, // guaranteeing that all necessary type information has been transmitted first. // Passing a nil pointer to Encoder will panic, as they cannot be transmitted by gob. func (enc *Encoder) Encode(e any) error { … } // sendTypeDescriptor makes sure the remote side knows about this type. // It will send a descriptor if this is the first time the type has been // sent. func (enc *Encoder) sendTypeDescriptor(w io.Writer, state *encoderState, ut *userTypeInfo) { … } // sendTypeId sends the id, which must have already been defined. func (enc *Encoder) sendTypeId(state *encoderState, ut *userTypeInfo) { … } // EncodeValue transmits the data item represented by the reflection value, // guaranteeing that all necessary type information has been transmitted first. // Passing a nil pointer to EncodeValue will panic, as they cannot be transmitted by gob. func (enc *Encoder) EncodeValue(value reflect.Value) error { … }