cannot convert a (type interface {}) to type string: need type assertion
cannot
convert a (type interface {}) to type *: need type assertion
解决方案:
var a interface{} = int(10)
var b MyInt = a.(MyInt)
参考:
http://stackoverflow.com/questions/19577423/how-to-cast-to-a-type-alias-in-go/19579058
本文介绍了在Go语言中如何进行类型断言以解决从interface{}
3万+

被折叠的 条评论
为什么被折叠?



