// GobDecoder is the interface describing data that provides its own // routine for decoding transmitted values sent by a GobEncoder. type GobDecoder interface { // GobDecode overwrites the receiver, which must be a pointer, // with the value represented by the byte slice, which was written // by GobEncode, usually for the same concrete type. GobDecode([]byte) error }


// GobEncoder is the interface describing data that provides its own // representation for encoding values for transmission to a GobDecoder. // A type that implements GobEncoder and GobDecoder has complete // control over the representation of its data and may therefore // contain things such as private fields, channels, and functions, // which are not usually transmissible in gob streams. // // Note: Since gobs can be stored permanently, it is good design // to guarantee the encoding used by a GobEncoder is stable as the // software evolves. For instance, it might make sense for GobEncode // to include a version number in the encoding. type GobEncoder interface { // GobEncode returns a byte slice representing the encoding of the // receiver for transmission to a GobDecoder, usually of the same // concrete type. GobEncode() ([]byte, error) }


// Debug prints a human-readable representation of the gob data read from r. // It is a no-op unless debugging was enabled when the package was built. func Debug(r io.Reader)


// 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


// NewEncoder returns a new encoder that will transmit on the io.Writer. func NewEncoder(w io.Writer) *Encoder


// Register records a type, identified by a value for that type, under its // internal type name. That name will identify the concrete type of a value // sent or received as an interface variable. Only types that will be // transferred as implementations of interface values need to be registered. // Expecting to be used only during initialization, it panics if the mapping // between types and names is not a bijection. func Register(value any)


// RegisterName is like Register but uses the provided name rather than the // type's default. func RegisterName(name string, value any)