Sort()
when using the function in the sort package
Cannot use c.ring (Type []uint32) as type sort. Interface in argument to sort. Sort:
[]uint32 does not implement sort. Interface (missing Len method)
cannot use c.ring (type []uint32) as type sort.Interface in argument to sort.Sort: []uint32 does not implement sort.Interface (missing Len method)
The reason is sort. The definition of Sort () is as follows
func Sort(data Interface)
type Interface interface { // Len方法返回集合中的元素个数 Len() [int](https://studygolang.com/static/pkgdoc/pkg/builtin.htm#int) // Less方法报告索引i的元素是否比索引j的元素小 Less(i, j [int](https://studygolang.com/static/pkgdoc/pkg/builtin.htm#int)) [bool](https://studygolang.com/static/pkgdoc/pkg/builtin.htm#bool) // Swap方法交换索引i和j的两个元素 Swap(i, j [int](https://studygolang.com/static/pkgdoc/pkg/builtin.htm#int))}一个满足sort.Interface接口的(集合)类型可以被本包的函数进行排序。方法要求集合中的元素可以被整数索引