const tooBig … type Decoder … // NewDecoder returns a new decoder that reads from the [io.Reader]. // If r does not also implement [io.ByteReader], it will be wrapped in a // [bufio.Reader]. func NewDecoder(r io.Reader) *Decoder { … } // recvType loads the definition of a type. func (dec *Decoder) recvType(id typeId) { … } var errBadCount … // recvMessage reads the next count-delimited item from the input. It is the converse // of Encoder.writeMessage. It returns false on EOF or other error reading the message. func (dec *Decoder) recvMessage() bool { … } // readMessage reads the next nbytes bytes from the input. func (dec *Decoder) readMessage(nbytes int) { … } // toInt turns an encoded uint64 into an int, according to the marshaling rules. func toInt(x uint64) int64 { … } func (dec *Decoder) nextInt() int64 { … } func (dec *Decoder) nextUint() uint64 { … } // decodeTypeSequence parses: // TypeSequence // // (TypeDefinition DelimitedTypeDefinition*)? // // and returns the type id of the next value. It returns -1 at // EOF. Upon return, the remainder of dec.buf is the value to be // decoded. If this is an interface value, it can be ignored by // resetting that buffer. func (dec *Decoder) decodeTypeSequence(isInterface bool) typeId { … } // Decode reads the next value from the input stream and stores // it in the data represented by the empty interface value. // If e is nil, the value will be discarded. Otherwise, // the value underlying e must be a pointer to the // correct type for the next data item received. // If the input is at EOF, Decode returns [io.EOF] and // does not modify e. func (dec *Decoder) Decode(e any) error { … } // DecodeValue reads the next value from the input stream. // If v is the zero reflect.Value (v.Kind() == Invalid), DecodeValue discards the value. // Otherwise, it stores the value into v. In that case, v must represent // a non-nil pointer to data or be an assignable reflect.Value (v.CanSet()) // If the input is at EOF, DecodeValue returns [io.EOF] and // does not modify v. func (dec *Decoder) DecodeValue(v reflect.Value) error { … } var debugFunc …