Go: difference between any and interface in varargs

Viewed 404

In Golang 1.18 I can do this:

func foo1[T any](items ...T) {
    // do something
}

func foo2(items ...interface{}) {
    // do something
}

Both of these appear to accept a list of objects whose type is not known by the function itself. Is there something I'm missing here?

0 Answers
Related