// checkInterface checks that the method set of x implements the // interface itype. // On success it returns "", on failure, an error message. // func checkInterface(i *interpreter, itype *types.Interface, x iface) string { mset := findMethodSet(i, x.t) it := itype.Underlying().(*types.Interface) for i, n := 0, it.NumMethods(); i < n; i++ { m := it.Method(i) id := ssa.MakeId(m.Name(), m.Pkg()) if mset[id] == nil { return fmt.Sprintf("interface conversion: %v is not %v: missing method %v", x.t, itype, id) } } return "" // ok }