我们可以运行从ubuntu生成的go build的输出到windwos

时间:2016-04-15 10:19:42

标签: ubuntu go

我是Go的新手,如果我错了,请纠正我。由于Go可执行文件是静态链接的。因此,如果我使用Linux (ubuntu),我可以在Windows中进行编码以及在部署时进行编码。那么,有可能这样做,或者我在这里遗漏了一些东西。

1 个答案:

答案 0 :(得分:2)

It is possible, but a bit more complex than what you describe. Regardless of statically compiling, the Go compiler can generate code from any platform to any platform.

For a quick guide on how to do it, see this article http://dave.cheney.net/2015/03/03/cross-compilation-just-got-a-whole-lot-better-in-go-1-5