func sliceEqual(a, b []interface{}) bool {
}
a := []*Student{}
b := []*Student{}
sliceEqual(a, b)
compile err:
cannot use a (type []*Student) as type []interface {} in argument to sliceEqual
golang不支持这种slice转换,可以先构造,再入参,例如:
a := []*Student{}
b := []*Student{}
arga := make([]interface{}, len(a))
for i := range a {
arga[i] = a[i]
}
argb := make([]interface{}, len(b))
for i := range b {
argb[i] = b[i]
}
sliceEqual(arga, argb)