duanne9313 2016-04-11 10:54
浏览 55
已采纳

将多个二进制文件构建到当前目录中

When doing go build github.com/.../foo from any directory, the compiled binary will be placed in the directory from which I executed the command. When doing go build /github.com/.../cmd/... I expected all of the compiled binaries to appear in my current directory. But they don't.

How can I compile multiple/all binaries of that package into my current work dir?

  • 写回答

3条回答 默认 最新

  • duanchuan6350 2019-01-28 17:58
    关注

    As the issue 23616 states:

    The fact that go build doesn't build is counter-intuitive

    You will be able to get multiple binaries in your current directory when... the issue 14295 "cmd/go: go build should be able to write multiple executables" will be completed.

    But that will be for Go 1.13 (not 1.12, so late 2019)

    This is so close to working. I'm not sure why it doesn't.
    We should fix it for Go 1.12.
    Clearly -o can't be used with multiple binary targets, but the implicit "write to the current directory" should work, and instead it does nothing.

    There is a bit of discussion on the proposed CL, as well s the comment that the CL as implemented breaks go build -a std cmd.

    See CL 143139/ (CL = "Change List").

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 无网格伽辽金方法研究裂纹扩展的程序
  • ¥15 如何用数码管显示学号(相关搜索:单片机)
  • ¥15 错误于library(org.Hs.eg.db): 不存在叫‘org.Hs.eg.db’这个名称的程序包,如何解决?
  • ¥60 求一个图片处理程序,要求将图像大小跟现实生活中的大小按比例联系起来的
  • ¥50 求一位精通京东相关开发的专家
  • ¥100 求懂行的大ge给小di解答下!
  • ¥15 pcl运行在qt msvc2019环境运行效率低于visual studio 2019
  • ¥15 MAUI,Zxing扫码,华为手机没反应。可提高悬赏
  • ¥15 python运行报错 ModuleNotFoundError: No module named 'torch'
  • ¥100 华为手机私有App后台保活