cmd/go/internal/modcmd: drop test sources and data from mod -vendor

The module support redefines the package pattern "all" to mean
all packages in the main module, plus their dependencies and
test dependencies, recursively. The idea was to make "go test all"
useful: it tests everything in the main module plus everything
the main module depends on, and so on. A complex project
is probably creating a combination of dependency versions
that has never existed before, so it is only prudent to make it
easy to test those dependencies in that configuration.

The vendor operation also applies to that same "all" set of packages.

But vendoring is freezing a combination that you're happy
with and hopefully have already tested. At that point the rationale
for including all the tests of dependencies is weakened, and
there is a significant space savings to not copying them (and
possibly-large associated test data) into the vendor directory.

This CL changes vendor to apply to all packages in the main
module, plus the (direct and indirect) dependencies of those
packages and their tests. Vendor no longer copies *_test.go into
the repo at all, nor the packages imported by those source files
and not imported otherwise.

Also copy legal files (LICENSE etc) when vendoring.

Fixes golang/go#25672.

Change-Id: I0713d4c751145df827460707e4085801fffa2a51
Reviewed-by: Bryan C. Mills <>
10 files changed
tree: df034dc3ba61441acd726ea6ac71671aab3c8f37
  7. codereview.cfg
  8. main.go
  9. vendor/

Versioned Go Prototype (vgo)

This repository holds a prototype of what the go command might look like with integrated support for package versioning.

See for documents about the design.


Use go get -u

You can also manually git clone the repository to $GOPATH/src/

Report Issues / Send Patches


This is still a very early prototype. You are likely to run into bugs. Please file bugs in the main Go issue tracker,, and put the prefix x/vgo: in the issue title.

Thank you.