Migrate from dep dependency manager to go modules to assist packagers.
Description
aws/amazon-ecs-init uses dep dependency manger instead of go modules. Conducting a migration at this time would be helpful. go1.16 changes the environment variable GO111MODULE default from auto to on. With this change, users building with go1.16 need to set GO111MODULE to auto to build as before. In a future version of go1.x support for GOPATH will be removed, so the migration needs to happen eventually. For some distributions, there is also automated tooling for go modules, that is not available for continued use of dep.
EDIT: For best usability with go tools, a migration to use go modules may also benefit from changes to the source layout so that go.modgo.sum are at the root of the published import path, i.e. the root of this repository. Acknowledged that source moves are a non-trivial change to be considered.
Expected Behavior
aws/amazon-ecs-init builds as before with versions of go1.16+
Observed Behavior
aws/amazon-ecs-init build fails with go1.16 unless GO111MODULE is changed from the new default.
A test run of go mod init converts from dep with the following minor issues reported:
$ go mod init aws/amazon-ecs-init
go: creating new go.mod: module aws/amazon-ecs-init
go: converting Gopkg.lock: stat github.com/coreos/go-systemd@v22.0.0: github.com/coreos/go-systemd@v22.0.0: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v22
go: copying requirements from Gopkg.lock
go: to add module requirements and sums:
go mod tidy
$ go mod tidy
go: downloading github.com/stretchr/testify v1.2.2
go: downloading github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575
go: downloading github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129
go: downloading github.com/aws/aws-sdk-go v1.36.0
go: downloading github.com/fsouza/go-dockerclient v0.0.0-20170830181106-98edf3edfae6
go: downloading github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5
go: downloading github.com/docker/go-plugins-helpers v0.0.0-20181025120712-1e6269c305b8
go: downloading github.com/Microsoft/go-winio v0.4.2
go: downloading github.com/docker/docker v1.4.2-0.20170530175538-4f55e390c4e5
go: downloading github.com/docker/go-units v0.3.2
go: downloading github.com/docker/go-connections v0.2.2-0.20170331145122-e15c02316c12
go: downloading github.com/Sirupsen/logrus v0.11.6-0.20170515105910-5e5dc898656f
go: downloading github.com/opencontainers/runc v1.0.0-rc3.0.20170530161907-a6906d5a531a
go: downloading github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5
go: downloading github.com/Azure/go-ansiterm v0.0.0-20160622173216-fa152c58bc15
go: downloading github.com/opencontainers/image-spec v1.0.0-rc6.0.20170525204040-4038d4391fe9
go: downloading github.com/opencontainers/go-digest v1.0.0-rc0.0.20170510163354-eaa60544f31c
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/engine
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/docker
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/config
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/exec
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/version
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/gpu
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/backoff
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/cache
go: downloading github.com/aws/amazon-ecs-init v1.25.3
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/exec/iptables
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/exec/sysctl
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/cmd
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/volumes/logger
go: finding module for package github.com/google/go-cmp/cmp
go: finding module for package github.com/coreos/go-systemd/activation
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/volumes
go: downloading github.com/google/go-cmp v0.5.5
go: downloading github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: found github.com/aws/amazon-ecs-init/ecs-init/config in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/engine in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/version in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/backoff in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/gpu in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/cache in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/docker in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/exec in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/exec/iptables in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/exec/sysctl in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/aws/amazon-ecs-init/ecs-init/cmd in github.com/aws/amazon-ecs-init v1.25.3
go: found github.com/google/go-cmp/cmp in github.com/google/go-cmp v0.5.5
go: found github.com/coreos/go-systemd/activation in github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/volumes/logger
go: finding module for package github.com/aws/amazon-ecs-init/ecs-init/volumes
aws/amazon-ecs-init/volumes/amazon-ecs-volume-plugin imports
github.com/aws/amazon-ecs-init/ecs-init/volumes: module github.com/aws/amazon-ecs-init@latest found (v1.25.3), but does not contain package github.com/aws/amazon-ecs-init/ecs-init/volumes
aws/amazon-ecs-init/volumes/amazon-ecs-volume-plugin imports
github.com/aws/amazon-ecs-init/ecs-init/volumes/logger: module github.com/aws/amazon-ecs-init@latest found (v1.25.3), but does not contain package github.com/aws/amazon-ecs-init/ecs-init/volumes/logger
Summary
Migrate from
dep
dependency manager to go modules to assist packagers.Description
aws/amazon-ecs-init uses
dep
dependency manger instead of go modules. Conducting a migration at this time would be helpful. go1.16 changes the environment variableGO111MODULE
default fromauto
toon
. With this change, users building with go1.16 need to setGO111MODULE
toauto
to build as before. In a future version of go1.x support for GOPATH will be removed, so the migration needs to happen eventually. For some distributions, there is also automated tooling for go modules, that is not available for continued use ofdep
.EDIT: For best usability with go tools, a migration to use go modules may also benefit from changes to the source layout so that
go.mod
go.sum
are at the root of the published import path, i.e. the root of this repository. Acknowledged that source moves are a non-trivial change to be considered.Expected Behavior
aws/amazon-ecs-init builds as before with versions of go1.16+
Observed Behavior
aws/amazon-ecs-init build fails with go1.16 unless
GO111MODULE
is changed from the new default.Environment Details
Supporting Log Snippets
A test run of
go mod init
converts fromdep
with the following minor issues reported:With the final result: