package main
import "fmt"
func main(){
a := []int{1,2,3}
fmt.Println(a...)
}
Running this gives the following error
./program.go:5: cannot use a (type []int) as type []interface {} in argument to fmt.Println
From godoc fmt Println
func Println(a ...interface{}) (n int, err error)
Println
accepts any value because it is an empty interface.
What's confusing to me is that
fmt.Println(a...)
is same as fmt.Println(a[0],a[1],a[2])
and yet one works but the other doesn't.
What am I missing here?