On Fri, Dec 15, 2017 at 8:18 AM, Ivan Kurnosov <zerk...@gmail.com> wrote:
> Why does this code not compile: https://play.golang.org/p/f5fMvO8Ns7
> func f(items ...interface{}) {
>  fmt.Println(items)
> }

The spec also says:

"If the final argument is assignable to a slice type []T, it may be
passed unchanged as the value for a ...T parameter if the argument is
followed by .... In this case no new slice is created."

https://golang.org/ref/spec#Passing_arguments_to_..._parameters

That is, you can pass in multiple arguments which will be combined in
to the items parameters as a slice or tab... can be passed as the
items parameter. You can't do both.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to