英文:
Can we run the output of go build generated from ubuntu to windwos
问题
我是你的中文翻译助手,以下是你要翻译的内容:
我对Go
语言还不熟悉,如果我说错了,请纠正我。由于Go
可执行文件是静态链接的,所以我可以在Windows上编写代码,并在同一台机器上构建它,但在部署时使用Linux(Ubuntu)吗?这样做是否可行,或者我漏掉了什么?
英文:
I am new to Go
, so correct me if, i am wrong. Since Go
executable are statically linked. So, can i code in windows as well as build it on the same but at the time of deployment if i use Linux (ubuntu)
. So, is it possible to do so or i am missing something here.
答案1
得分: 2
可以的,但比你描述的要复杂一些。不论是否进行静态编译,Go编译器都可以将代码从任何平台生成到任何平台。
关于如何进行交叉编译的快速指南,可以参考这篇文章:http://dave.cheney.net/2015/03/03/cross-compilation-just-got-a-whole-lot-better-in-go-1-5
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论