func getInterfaces(typs []Type) []Interface {
	var interfaces []Interface
	for _, typ := range typs {
		if iface, ok := typ.TypeName.Type().Underlying().(*types.Interface); ok {
			interfaces = append(interfaces, Interface{typ.Object.Name(), iface, typ.Object})
		}
	}
	return interfaces
}
getInterfaces extracts all the interfaces from the objects we
parsed.
package main  
import (
	"flag"
	"fmt"
	"go/types"
	"os"
	"strings"
	"golang.org/x/tools/go/loader"
	"github.com/kisielk/gotool"
)
var (
	interfacesFrom string
	typesFrom      string
	reverse        bool
	printHelp      bool
)
func init() {
	flag.StringVar(&interfacesFrom, "interfaces", "std", "Comma-separated list of which packages to scan for interfaces. Defaults to std.")
	flag.StringVar(&typesFrom, "types", "", "Comma-separated list of packages whose types to check for implemented interfaces. Required.")
	flag.BoolVar(&reverse, "reverse", false, "Print 'implemented by' as opposed to 'implements' relations.")
	flag.BoolVar(&printHelp, "help", false, "Print a help text and exit.")
	flag.Parse()
}
type Interface struct {
	Name       string
	Underlying *types.Interface
	Obj        types.Object
}
type Type struct {
	Object   types.Object
	TypeName *types.TypeName
	Pointer  *types.Pointer
}