cmd/go/internal/vgo: allow vgo get of module with no package in root

Historically "go get" has meant both "download these packages" and
"install these packages". For example "go get"
downloads that package but also builds and installs it (into $GOBIN/issue).
Similarly "go get" downloads, builds, and
installs that package (not a package main).

If one needs to just download a whole repo, it has always tripped
up users that "go get" fails, because there are no
Go source files in that directory (the root of that repo, it turns out).

Go modules compound this problem, because it is quite natural
to want to run "go get" to add (or to
upgrade or downgrade to) that specific version of

This CL changes "go get" to make this common usage not an error:
if the path is successfully identified as a directory within a known
module, then if there's no code there, "go get" just skips the
"build and install" step, instead of reporting an error.
This way, command installations like "go get"
continue to work, but now module installations like "go get"
or "go get" also now succeed.

Fixes golang/go#24008.

Change-Id: I977ab448bc13a4391e85f63052b8373e30f77026
Reviewed-by: Bryan C. Mills <>
3 files changed
tree: c3e89fdceccffd11986501b35d274a538eb9b865
  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.