cmd/go/internal/vgo: adjust 'module mode enabled' decision

This new implementation matches the recently-written help docs, which say:

For more fine-grained control, the module support in Go 1.11 respects
a temporary environment variable, GO111MODULE, which can be set to one
of three string values: off, on, or auto (the default).
If GO111MODULE=off, then the go command never uses the
new module support. Instead it looks in vendor directories and GOPATH
to find dependencies; we now refer to this as "GOPATH mode."
If GO111MODULE=on, then the go command requires the use of modules,
never consulting GOPATH. We refer to this as the command being
module-aware or running in "module-aware mode".
If GO111MODULE=auto or is unset, then the go command enables or
disables module support based on the current directory.
Module support is enabled only when the current directory is outside
GOPATH/src and itself contains a go.mod file or is below a directory
containing a go.mod file.

The global -vgo flag is removed in favor of the environment variable.

Change-Id: I935466cb5cd6825a5c6926d012eab2cb74bb2832
Reviewed-by: Bryan C. Mills <>
4 files changed
tree: 0aa63e1bd6d9a6f0497d294a75caca4dad9d7324
  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.