Go: go1.15.8 darwin/amd64 OS: MacOS 11.2.1 The program here <https://play.golang.org/p/Jgx2Ihq5C69> includes a function with variadic arguments: func outputStrings(strings …string)
Individual strings can be passed specifically: outputStrings("foo", "bar") You can also use an ellipses to covert the content of an array to the individual arguments: myStrings := []string{"foo", "bar"} outputStrings(myStrings...) I expected that this would work as well: outputStrings("foo", "bar", myStrings...) But it leads to: # variadic ./variadic.go:17:15: too many arguments in call to outputStrings have (string, string, []string...) want (...string) The error message is clear, and easily worked around, so my question isn’t so much *why* the error occurred, by rather *should* it have occurred? It seems to me that the format of the function call make it clear and unambiguous to the compiler what’s being passed. There was similar discussion here <https://groups.google.com/g/golang-nuts/c/BlTgE3ZHI8c/m/0_2Vy1BcX5cJ>, but it was left unresolved. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d7f2e4ac-da8a-4973-a5bd-49c82b738d9an%40googlegroups.com.