Is it best-practice to commit the `vendor` directory?

后端 未结 3 428
栀梦
栀梦 2020-12-17 08:34

I am using dep to handle my Go dependencies. Is it best practice to also commit the vendor directory into version control? Or is best practice to a

3条回答
  •  旧时难觅i
    2020-12-17 09:29

    The dep tool's FAQ answers this:

    Should I commit my vendor directory?

    It's up to you:

    Pros

    • It's the only way to get truly reproducible builds, as it guards against upstream renames, deletes and commit history overwrites. * You don't need an extra dep ensure step to sync vendor/ with Gopkg.lock after most operations, such as go get, cloning, getting latest, merging, etc.

    Cons

    • Your repo will be bigger, potentially a lot bigger, though dep prune can help minimize this problem. * PR diffs will include changes for files under vendor/ when Gopkg.lock is modified, however files in vendor/ are hidden by default on Github.

提交回复
热议问题