Golang静态库文件的用途是什么?

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

What's the usage of Golang static library file?

问题

我了解到go install <主包>命令会将依赖包编译成静态库文件,并将其安装到pkg目录中,但在运行可执行文件时,并不需要这些库文件。我还发现,在编译时源文件是必需的。

那么,这些静态文件有什么特殊的用途吗?

英文:

I see go install &lt;main package&gt; will compile the dependency packages into static library files and install them into the pkg directory, but the executable doesn't need the library files when running. And I also discover that source file is necessary when compiling.

So, is there any special usage of the static files?

答案1

得分: 3

编译的软件包可以在编译其他内容时重复使用。这样可以节省后续编译的时间。当你重新编译时,只需要编译该软件包及其依赖项,而不需要编译其依赖的其他软件包。

它们还包含gocode用于自动完成的数据。

英文:

The compiled packages can be reused if you compile something else. This saves time on subsequent compiles. When you recompile you only need to compile the package and the things that depend on it, not its dependencies.

They also contain data used by gocode for autcompleting.

huangapple
  • 本文由 发表于 2015年7月7日 11:00:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/31259023.html
匿名

发表评论

匿名网友

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

确定