问题:
在使用interface表示任何类型时,如果要将interface转为某一类型,直接强制转换是不行的,例如:
var t interface{} = "abc"
s := string(t)
cannot convert t(type interface {}) to type string: need type assertion
这样是不行的,需要进行type assertion类型断言,具体使用方法请参考:
golang 任何类型interface{}
更多信息:
http://blog.csdn.net/lanyang123456/article/details/78070886