英文:
Importing all external golang modules to one file and then importing from that file?
问题
有没有一种方法可以将外部模块导入到一个文件中,然后从该文件中导入?
例如:
// externals.go
import (
Bitbucket "bitbucket.org/user/project"
Github "github.com/user/project"
)
// main.go
import (
"externals/Bitbucket"
"externals/Github"
)
以上的形式是否可行?
英文:
Is there a way to import external modules into one file and then import from that file?
For example:
// externals.go
import (
Bitbucket "bitbucket.org/user/project"
Github "github.com/user/project"
)
// main.go
import (
"externals/Bitbucket"
"externals/Github"
)
Is the above in some form possible?
答案1
得分: 1
不,这是不可能的。Go语言的一个特定设计目标是使所有依赖关系都明确可见。
请参阅http://talks.golang.org/2012/splash.article,特别是第7节,以获取更多详细信息。
英文:
No, this is not possible. It is a specific design goal of Go
to make all dependencies explicit.
See http://talks.golang.org/2012/splash.article and section 7
in particular for more detail on this.
答案2
得分: 0
不,这是不可能的,即使使用一些技巧也不行。
英文:
No. This is not possible, not even with some tricks.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论