简体   繁体   English

go:如何定义依赖关系?

[英]go: How to define dependencies?

How are dependencies specified in go? 如何在go中指定依赖项?

For example in node.js you have package.json and you define dependencies like this: https://docs.npmjs.com/files/package.json#dependencies 例如,在node.js中,您具有package.json并且您可以这样定义依赖项: https : //docs.npmjs.com/files/package.json#dependencies

Is there a "meta" definition like package.json in go? go中是否有像package.json这样的“元”定义?

No, each source file import packages, you specify the main file (your entry point) when you compile. 不,每个源文件导入包都需要在编译时指定主文件(您的入口点)。 The dependency graph is built on the fly at compile time. 依赖关系图是在编译时动态构建的。 Circular dependencies are forbidden. 禁止循环依赖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM