may be missing the point, but why go thought an interface{}?
https://play.golang.org/p/Ol7e6UrNAWq
--
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+u
Thanks :)
திங்., 15 ஏப்., 2019, பிற்பகல் 4:20 அன்று, roger peppe
எழுதியது:
> The dynamic type conversion needs to specify the exact type that was put
> into the interface (B in this case).
> You can convert it back to A afterwards:
> https://play.golang.org/p/jBRtR_8RloC
>
> On Mon, 15 Apr 2019
The dynamic type conversion needs to specify the exact type that was put
into the interface (B in this case).
You can convert it back to A afterwards:
https://play.golang.org/p/jBRtR_8RloC
On Mon, 15 Apr 2019 at 11:32, Sankar P wrote:
> Playground url: https://play.golang.org/p/tDT7xCJJ_XN
>
> த
Playground url: https://play.golang.org/p/tDT7xCJJ_XN
திங்., 15 ஏப்., 2019, பிற்பகல் 4:01 அன்று, Sankar <
sankar.curios...@gmail.com> எழுதியது:
> I have the following go code:
>
> ```
> type A map[string]interface{}
> type B map[string]interface{}
>
> func f(a A) {
> fmt.Println(a)
> }
>
> func m
I have the following go code:
```
type A map[string]interface{}
type B map[string]interface{}
func f(a A) {
fmt.Println(a)
}
func main() {
var b B
b = make(map[string]interface{})
i := interface{}(b)
f(i.(A))
}
```
This code panics when I try to convert the B instance to type A. What is
the ri