could something like this help; https://play.golang.org/p/9tbiUY1w0d


On Friday, 12 August 2016 19:41:26 UTC+1, Vasily Korytov wrote:
>
> Hi,
>
> I have an interface{} variable that can be either string or a list of 
> string (yes, that's bad design, I know).
>
> I need a []string to feed it to strings.Join (I need one string for 
> output).
>
> This way works, that is explicitly creating []string and copying each 
> element to it:
>
> var list []string
> for _, v := range mail.([]interface{}) {
> list = append(list, v.(string))
> }
> rcpt = strings.Join(list, ", ")
>
> Have I overlooked something and there is a way to do it in a more graceful 
> and effective way?
>
> Thanks.
>
> -- 
>   Vasily Korytov
>   https://chillum.github.io
>

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