cmd/go/internal/vgo: process packages for all build tags in vendor

Until now, "vgo vendor" has only considered the packages needed
for a build with the current GOOS/GOARCH and build tags.
If a module has both linux-specific and windows-specific
requirements, then "vgo vendor" on windows will omit the
linux code, and vice versa, making it impossible to prepare
a full vendor set.

This CL introduces a new (for now undocumented) package
pattern "ALL" that is like "all" but follows imports in files
requiring any plausible build tag, producing a set of files
that does not vary from system to system.

The only +build lines not satisfied when computing "ALL"
packages are those listing only the tag "ignore" or those
listing only syntactically invalid build tags. For example,
a file containing any of these lines not be processed:

	// +build ignore
	// +build !
	// +build @#$%^&*()

(The first two are commonly used in practice to exclude
a file from processing by the go command.)

This CL then changes the "vgo vendor" command to
process "ALL" packages, not "all" packages.

It also changes the vendor/vgo.list output file to list only
modules that had files copied out of them and to indicate
which packages came from which modules.

Fixes golang/go#25376.
Fixes golang/go#25624.

Change-Id: I6756286fa6bb697819279ef67b4bea68bc0b7f53
Reviewed-on: https://go-review.googlesource.com/117258
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
29 files changed
tree: 8d9502fa3eddabc09d719312398af9b30d45907e
  1. AUTHORS
  2. CONTRIBUTING.md
  3. CONTRIBUTORS
  4. LICENSE
  5. PATENTS
  6. README.md
  7. codereview.cfg
  8. main.go
  9. vendor/
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.