定义函数只能使用本地当前包中的类型,不能使用其他包中的类型

所以定义其他包的别名类型,通常会导致报错:  type Talias =  其他包.T

cannot define new methods on non-local type time.Duration
 
 
对于其他包中的类型,本地若想使用
可以在本地重新定义个自定义类型 type myT  其他包.T
原文地址:https://www.cnblogs.com/keystone/p/12983391.html