type Point … func (p Point) Hypotenuse() float64 { … } type Pythagoras … // This example shows how to encode an interface value. The key // distinction from regular types is to register the concrete type that // implements the interface. func Example_interface() { … } // interfaceEncode encodes the interface value into the encoder. func interfaceEncode(enc *gob.Encoder, p Pythagoras) { … } // interfaceDecode decodes the next interface value from the stream and returns it. func interfaceDecode(dec *gob.Decoder) Pythagoras { … }