可以在不复制的情况下嵌入一个包吗?

huangapple go评论82阅读模式
英文:

Is it possible to embed a package without to copy it?

问题

我们有一个名为encoding/json的包。我是否可以创建一个名为mypackage的包,并将所有函数(至少是公共函数)嵌入到我的包中,而无需手动复制它们,并基本上调用实际的json包?我正在开发一个跨平台(Google应用引擎/本地)解决方案,我认为这样的解决方案非常有用。

英文:

Say there we have the package encoding/json. Can I just create a package mypackage and embed all the functions (at least the public functions) into my package without to copy them by hand and basically do calls back to the actual json package? I'm developing a cross platform (Google app engine / native ) solution and I would find a such solution quite useful.

答案1

得分: 0

不支持包继承这个功能。

英文:

No.

It sounds like you want some sort of package inheritance, this is not a supported feature.

huangapple
  • 本文由 发表于 2015年2月24日 03:44:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/28682043.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定