We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
go1.10.3
go env
the same to macbookpro2015
https://play.golang.org/p/tyV3T-pkUy6
func test(i ...interface{}){} a := []int{1,2,3} test(a...) // cannot use a (type []int) as type []interface {} in argument to test
why it can't be complied? a... is not equal to a[0], a[1], a[2] ???
a...
a[0], a[1], a[2]
i suppose that ellipsis operator really split the slice and pass to the function as variadic parameter. so make code like above success to be complied
The text was updated successfully, but these errors were encountered:
This is a variant of the topic explained here: https://golang.org/doc/faq#convert_slice_of_interface
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?go1.10.3
What operating system and processor architecture are you using (
go env
)?the same to macbookpro2015
What did you do?
https://play.golang.org/p/tyV3T-pkUy6
why it can't be complied?
a...
is not equal toa[0], a[1], a[2]
???What did you expect to see?
i suppose that ellipsis operator really split the slice and pass to the function as variadic parameter.
so make code like above success to be complied
The text was updated successfully, but these errors were encountered: