GO函数参数中数组的通用类型

I have this function:

func functionX(collection []*interface{}) {
    ...
    response, err := json.MarshalIndent(collection, "", "  ")
    ...
}

I want the collection parameter to allow arrays of any kind, that's why I tried with *interface{} but I'm receiving errors like this:

cannot use MyDataType (type []*model.MyDataType) as type []*interface {} in argument to middleware.functionX

You can't do it that way, however you can easily do this:

func functionX(collection interface{}) error {
    ...
    response, err := json.MarshalIndent(collection, "", "  ")
    ...
}

playground