dongshen7561 2015-05-18 17:44
浏览 1029
已采纳

golang项目如何打包以进行部署?

Coming from a JVM background I would like to know how to deploy a golang project to production. Is there an equivalent of a JAR file?

Is there a standalone package manager that can be installed on server and a dependency manifest file which can be run to bring down all dependencies on the server. I specifically do not want to have to build the project on the server as we can't have any compilers etc on production boxes.

thanks.

  • 写回答

1条回答 默认 最新

  • douyao7390 2015-05-18 17:52
    关注

    I you run go install <pkg>, the binary will be placed in $GOPATH/bin. You can copy that binary to another machine that has the same OS and architecture.

    You can also change into the directory that includes the main package and just run go build. The binary will be placed in the current directory.

    There are no dependencies in a Go binary for you to track. It is statically linked. (Some system libraries may be dynamically linked, but if you are running on the same OS, this shouldn't be a problem.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别