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
Run-TryBot: Russ Cox <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Bryan C. Mills <>
29 files changed
tree: 8d9502fa3eddabc09d719312398af9b30d45907e
  1. vendor/
  3. codereview.cfg
  7. main.go

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.