I recently started looking for functional go examples and I found this function:
mapper := func (i interface{}) interface{} {
return strings.ToUpper(i.(string))
}
Map(mapper, New(“milu”, “rantanplan”))
//[“MILU”, “RANTANPLAN”]
Now in this function, as you can see the return
value of mapper is:
strings.ToUpper(i.(string))
.
But, what does this i.(string)
syntax mean? I tried searching, but didn't find anything particularly useful.