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条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效