douhuanqiao5290 2012-04-07 17:15
浏览 20

带有go依赖包的可复制发行版

I'm reading the "How to Write Go Code" tutorial, and I can't help wondering how can set up a stable workflow.

Naturally, my code would sit under source control, say Git. Now I want to be able to do the following:

  • Build the executables of my project - and being sure that for a given Git version, the executables will build the same.
  • Run a continuous build for my project to be activated on every commit. I need to be sure that whatever the continuous build does is reproducible on my workstation.
  • Create releases of my project. I need to know that a release can be recreated if I do it again from the same git version of my code.

Go provides the "go get" tool for it - but here's where I get confused. The tool that should support this, "go get", sets up the dependent packages' source control repo. Which gives me the following problems:

  1. I cannot put the dependent packages under my own source control. Which means that if there are any environment differences between me and my collaborators, or me and my continuous build system, we will have a tough time figuring out those differences.
  2. If the network is down, I won't be able to build my code from scratch. Or, to put it in a different way, my continuous build system would have to hit all those external servers every time it builds a release. This might be fragile, or even not something I'd be willing to let the outside world know.
  3. Go defines a convention of synchronizing package versions with those of the base language, but there's no guarantee the package authors will follow that convention. And if they don't, a clean workspace will pick up an arbitrary release which might be broken.
  4. If a project I depend on is abandoned, I can lose the ability to build my program.

I can work around those by importing the code for dependent projects manually and not using "go get" at all - but then, I'm avoiding a tool the language specifically designed and promoted for that use.

Any suggestions? Am I missing something?

  • 写回答

1条回答 默认 最新

  • dongyan8896 2012-04-07 20:45
    关注

    go get just uses the distributed version control system the source repo's use. It will use the local copy of the repo. I'll try to address each of your concerns here.

    1. You are certainly able to make modifications in the local repo and commit them there if you want.
    2. go get uses the local repository it built first unless you tell it to update explicitly.
    3. go get doesn't blow away the repository it will still be there. And since all the source control systems understood by go get are distributed source control systems there is no reason you can't keep a fork of the project going yourself.
    评论

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计