The interface that gob uses to replace the default marshal and unmarshal behaviors are found in the encoding package:
type BinaryMarshaler interface {
MarshalBinary() (data []byte, err error)
}
type BinaryUnmarshaler interface {
UnmarshalBinary(data []byte) error
}
During the decoding phase, any struct fields that are not present are ignored, since the field name is also part of the serialization.