You have defined your function to accept a slice as an argument, while you’re trying to pass an array in the call to that function. There are two ways you could address this:
-
Create a slice out of the array when calling the function. Changing the call like this should be enough:
nameReader(a[:]) -
Alter the function signature to take an array instead of a slice. For instance:
func nameReader(array [3]name) { ... }Downsides of this solution are that the function can now only accept an array of length 3, and a copy of the array will be made when calling it.
You can find a more details on arrays and slices, and common pitfalls when using them here