[go-nuts] Re: Why a []interface{} containing 2 different interface should use function like this?

2017-05-05 Thread eZio Pan
Thank you Pierre Curto! You help me out! That's the answer I need!!! Thank you again! 在 2017年5月5日星期五 UTC+8下午7:58:53,Pierre Curto写道: > > Since S1 and S2 satisfy the Stringl interface just use that for your slice > type and you get something like (note that you do not need to specify the >

[go-nuts] Re: Why a []interface{} containing 2 different interface should use function like this?

2017-05-05 Thread pierre . curto
Since S1 and S2 satisfy the Stringl interface just use that for your slice type and you get something like (note that you do not need to specify the variables types if you initialize them like you did). https://play.golang.org/p/pJHU0Dq8t6 Le vendredi 5 mai 2017 13:35:42 UTC+2, eZio Pan a

[go-nuts] Re: Why a []interface{} containing 2 different interface should use function like this?

2017-05-05 Thread Volker Dobler
See https://golang.org/doc/faq#convert_slice_of_interface V. On Friday, 5 May 2017 13:35:42 UTC+2, eZio Pan wrote: > > Hi, I'm a newbie in Golang. I get stuck in a problem that I can't > understand why. I wish someone could help me out. Thanks! > > There are 2 struct type *S1* and *S2*. Both of