Listing interfaces in interfaces

Take a look at the following example of an interface definition, this one isfrom the package container/heap:

  1. type Interface interface {
  2. sort.Interface
  3. Push(x interface{})
  4. Pop() interface{}
  5. }

Here another interface is listed inside the definition of heap.Interface, thismay look odd, but is perfectly valid, remember that on the surface an interface is nothingmore than a listing of methods. sort.Interface is also such a listing, so it isperfectly legal to include it in the interface.