Description
What version of Go are you using (go version
)?
$ go version go version go1.15.5 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/sebastiaan/Library/Caches/go-build" GOENV="/Users/sebastiaan/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/sebastiaan/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/sebastiaan/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.15.5/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.15.5/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/sebastiaan/go/src/github.com/containerd/containerd/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/c_/vjh56sc12fd2b_q2n02_lt140000gn/T/go-build441796130=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
containerd recently switched to using go modules (with vendoring), and I noticed that go.mod
for dependencies is only preserved if the main module is used, for example;
https://github.com/containerd/containerd/tree/59a0667cff783b9e4e61ea2a138db220b4fbdca2/vendor/github.com/containerd/cgroups
However, a dependency for which only some packages are vendored, but not the main module, go.mod
, and go.sum
are omitted; for example: https://github.com/containerd/containerd/tree/59a0667cff783b9e4e61ea2a138db220b4fbdca2/vendor/github.com/opencontainers/runc
What did you expect to see?
I expected both go.mod
and go.sum
to be preserved for any dependency, irregardless if the main module is consumed or not (similar to how LICENSE
and NOTICE
of the main module are preserved.
What did you see instead?
I saw that go.mod
and go.sum
are only preserved if the main module is consumed.