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-on: https://go-review.googlesource.com/122256
Reviewed-by: Bryan C. Mills <bcmills@google.com>
10 files changed
tree: df034dc3ba61441acd726ea6ac71671aab3c8f37
  1. vendor/
  2. AUTHORS
  3. codereview.cfg
  4. CONTRIBUTING.md
  5. CONTRIBUTORS
  6. LICENSE
  7. main.go
  8. PATENTS
  9. README.md
README.md

Versioned Go Prototype (vgo)

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

See research.swtch.com/vgo for documents about the design.

Download/Install

Use go get -u golang.org/x/vgo.

You can also manually git clone the repository to $GOPATH/src/golang.org/x/vgo.

Report Issues / Send Patches

See CONTRIBUTING.md.

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

Thank you.