如何用.a文件编译golang程序(无源代码) [英] How to compile golang program with .a file (without source)
问题描述
我需要编译我的程序 - main.go,其中包含没有源代码的bigPak包。只存在bigPak.a tnto GOPATH / pkg。
你能给我一个用bigPak.a编译main.go的例子么?
这很简单:只需在右边的$ GOPATH / src位置产生一个假的bigPak包(一个空的 Go旨在能够从.a文件进行编译,而无需传递读取它们的包含。 Go工具使用source(only)来检查.a文件是否需要重新编译(因为源代码较新。) I need to compile my program - main.go with package bigPak without source. Exist only bigPak.a tnto GOPATH/pkg. Can you give me example of compile main.go with bigPak.a ? That's dead simple: Just produce a fake bigPak package in the right $GOPATH/src location (an empty Go is designed to be able to compile from the .a files without transitively reading their includes. The Go tool uses the source (only) to check if an .a files needs to be recompiled (because the source is newer. 这篇关于如何用.a文件编译golang程序(无源代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!包bigPak
will do)和( important !!)确保此合成源在修改bigPak.a的时间之前修改时间。 go工具应该像这样工作。
package bigPak
will do) and (important!!) make sure this synthetic source has a modification time before the modification time of bigPak.a. The go tool should just work like this.