It's because strings.Join accepts slice while *s* is array. You should use 
*s[:]* to get slice:

fmt.Println(strings.Join(s[:], ","))


On Thursday, January 26, 2017 at 7:06:23 PM UTC+3, Joey Miller wrote:
>
> var s [2]string
> s[0] = "PASS"
> s[1] = "FAIL"
> fmt.Println(strings.Join(s, ","))
>
>
> The following code fails, I know this works with a slice, But I am a 
> newbie to go and I am trying to figure out the reason why this fails? Does 
> it have something to do with cap or len? 
>
>
>

-- 
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