drw85135
2015-01-15 05:01
浏览 371
已采纳

Go编译文件如何在不同的OS或CPU架构上工作?

Since I have started to learn Golang since yesterday :) I have a question about the compiled file.

Let's assume that I compile my project. It generates an .exec file in /bin folder. Now my question is Since the file has been compiled on Mac with Intel based CPU, should it be compiled on other OS and other CPU architectures such as AMD, ARM, etc. if I want to publish it to public?

I guess this should not be problem if I'm using GO lang for my backend since I run it on a server. However, what happens if I publish my .exec file, let's say on AWS, with lots of instances that they are automatically increases/decreases based on load? Does it problem?

Edit:

This is nice solution for those how are looking Go cross compiling tool https://github.com/mitchellh/gox

图片转代码服务由CSDN问答提供 功能建议

自从昨天开始学习Golang以来:)我对编译后的文件有疑问。

假设我编译了我的项目。 它在/ bin文件夹中生成一个.exec文件。 现在我的问题是,由于该文件已经在Mac上使用基于Intel的CPU进行编译,如果我想公开发布该文件,是否应该在其他OS和其他CPU体系结构(例如AMD,ARM等)上进行编译?

我想如果我在后端使用GO lang作为后端,那应该不会有问题,因为我是在服务器上运行它的。 但是,如果我发布.exec文件(比如说在AWS上),并且有很多实例会根据负载自动增加/减少,那会发生什么呢? 会不会有问题?

编辑

对于那些看起来像Go交叉编译工具 https://github.com/mitchellh/gox

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题