Skip to content

Replace godep with govendor

Tomasz Maczukin requested to merge replace-godep-with-govendor into master

What does this MR do?

Replaces Godep with govendor as dependencies management tool.

Why was this MR needed?

Godep is used almost from the beginning of this project. After using it for last two years we know it is sometimes problematic to use (e.g. https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/v1.11.1/CONTRIBUTING.md#managing-build-dependencies).

For Gitaly we've chosen govendor (gitaly#15 (closed)). Also GitLab Workhorse switched from Godep to govendor (gitlab-workhorse!126 (merged)). I think it's time to switch GitLab Runner from Godep to something less problematic. And since govendor is already used by half of our Go projects, I think this is the right choice here.

Are there points in the code the reviewer needs to double check?

I've checked differences between old Godeps/Godeps.json and vendor/vendor.json. I see only one difference which looks like a fix done by govendor. However it would be good if someone would look at how I compared this and confirm that it make sens:

  1. Normalize Godep lockfile:

    $ cat Godeps/Godeps.json | jq '.Deps[] | .ImportPath + " " + .Rev + " (" + .Comment + ")"' | sort > godep
  2. Normalize govendor lockfile:

    $ cat vendor/vendor.json | jq '.package[] | .path + " " + .revision + " (" + .comment + ")"' | sort > govendor
  3. Compare dependency lists:

    $ diff godep govendor
    77d76
    < "github.com/opencontainers/runc/libcontainer/utils ce450bcc6c135cae93ee2a99d41a308c179ff6dc (v1.0.0-rc2-240-gce450bc)"

    govendor is removing the github.com/opencontainers/runc/libcontainer/utils package with ce450bcc6c135cae93ee2a99d41a308c179ff6dc revision. Let's check why:

    $ grep github.com/opencontainers/runc/libcontainer/utils Godeps/Godeps.json -B 1 -A 3
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/utils",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
    --
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/utils",
                        "Comment": "v1.0.0-rc2-240-gce450bc",
                        "Rev": "ce450bcc6c135cae93ee2a99d41a308c179ff6dc"
                }

    The package is stored by Godep twice, in two different revisions. Let's check if there are any other libcontainer subpackages used by us:

    $ grep github.com/opencontainers/runc/libcontainer Godeps/Godeps.json -B 1 -A 3
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/fs",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/configs",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/system",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/user",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/utils",
                        "Comment": "v0.0.9",
                        "Rev": "94dc520a5732126985fec249f80c91b9e0601815"
                },
    --
                {
                        "ImportPath": "github.com/opencontainers/runc/libcontainer/utils",
                        "Comment": "v1.0.0-rc2-240-gce450bc",
                        "Rev": "ce450bcc6c135cae93ee2a99d41a308c179ff6dc"
                }

    There is few subpackages of github.com/opencontainers/runc/libcontainer in v0.0.9 version. For some reason the additional github.com/opencontainers/runc/libcontainer/utils in v1.0.0-rc2-240-gce450bc version was added to Godeps.json in 32b9fc0816aa77401a17290af71b54b955d0890b (part of !301 (merged)).

There are no other changes in dependencies list than this one doubled package. Looking at changed files in /vendor directory we can see that govendor removed some not *.go files, and updated few of them. In all but two files it is a comment added after package declaration. The only files updated more than this one comment are:

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Merge request reports