【发布时间】:2018-01-29 07:20:16
【问题描述】:
我需要一种将结构/接口动态转换回其原始对象的方法。 我可以在里面添加方法/函数。基本上我需要这样的东西:
MyStruct => Interface{} => MyStruct
在最终转换时,除了结构内部的内容之外,我对原始结构一无所知,所以我不能这样:
a.(MyStruct)
【问题讨论】:
-
Go 是静态类型的,所以如果你需要特定类型的结构,你必须知道编译时是什么类型
-
I don't know anything about the original struct besides what come inside the struct什么意思?