Jesse, what you quoted is an optimisation for the "Otherwise, the value passed is a new slice of type []T with a new underlying array whose successive elements ".
Your quote says: if the final argument is assignable - it may be passed as is, without any copy involving. On 15 December 2017 at 12:59, Jesse McNelis <jes...@jessta.id.au> wrote: > 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. > -- With best regards, Ivan Kurnosov -- 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.