We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如: import "github.com/duke-git/lancet/v2 便可以通过lancet.XXX()的方式使用到所有函数
import "github.com/duke-git/lancet/v2
lancet.XXX()
否则,若大量使用到lancet各包中的函数时,代码中可能会出现如下情况
import ( "github.com/duke-git/lancet/v2/xx1` "github.com/duke-git/lancet/v2/xx2` "github.com/duke-git/lancet/v2/xx3` ... )
这样加重了使用负担,每使用一个函数都会去查看是属于哪个子包下的函数,且容易造成和其它包的包名冲突,不得不给包名起导入别名
若在意编译了多余的不使用的子代码包(比如部分用户可能只会用到个别函数,却编译了整个包),可以2种方式都同时支持。但个人觉得微乎其微
The text was updated successfully, but these errors were encountered:
入别名
@CcccFz lancet中有很多重名方法(例如slice/filter, maputil/filter), package的作用一是代码复用,二是做命名空间。go不支持命名空间语法。兼容性很重要,2种方式都需要支持。如果所有方法都在一个lancet包下,需要导入所有对应的子包,然后定义对应方法的包全局变量。针对重名方法还要重新命名。代码复杂度增加,维护困难,投入产出比低。
Sorry, something went wrong.
No branches or pull requests
如:
import "github.com/duke-git/lancet/v2
便可以通过
lancet.XXX()
的方式使用到所有函数否则,若大量使用到lancet各包中的函数时,代码中可能会出现如下情况
这样加重了使用负担,每使用一个函数都会去查看是属于哪个子包下的函数,且容易造成和其它包的包名冲突,不得不给包名起导入别名
若在意编译了多余的不使用的子代码包(比如部分用户可能只会用到个别函数,却编译了整个包),可以2种方式都同时支持。但个人觉得微乎其微
The text was updated successfully, but these errors were encountered: