数码资讯
golang解决cannot convert a (type interface {}) to type *: need type assertion
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
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
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。