cmd/go/internal/modfetch: add detail to "missing go.mod" errors

Explain what's wrong better than "missing or invalid go.mod".
While we're here, improve the signal-to-noise ratio too.

Before this CL, using the scenario from golang/go#24522:

$ vgo get github.com/rsc/blackfriday/v2
go: github.com/rsc/blackfriday/v2 v2.0.1: missing or invalid go.mod
go get github.com/rsc/blackfriday/v2: missing or invalid go.mod

$ vgo get github.com/rsc/blackfriday/v2@v2.0.1-bad
go: github.com/rsc/blackfriday/v2 v2.0.1-bad: missing or invalid go.mod
go get github.com/rsc/blackfriday/v2@v2.0.1-bad: missing or invalid go.mod

After this CL:

$ vgo get github.com/rsc/blackfriday/v2
go: github.com/rsc/blackfriday/v2@v2.0.0: missing github.com/rsc/blackfriday/go.mod and .../v2/go.mod at revision v2.0.0
go: error loading module requirements

$ vgo get github.com/rsc/blackfriday/v2@v2.0.1-bad
go: github.com/rsc/blackfriday/v2@v2.0.1-bad: go.mod has non-.../v2 module path "github.com/rsc/blackfriday" (and .../v2/go.mod does not exist) at revision v2.0.1-bad
go: error loading module requirements

Fixes golang/go#24522.

Change-Id: I1471729cdde8345130d771f26b1501638b7452d2
Reviewed-on: https://go-review.googlesource.com/122399
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 files changed
tree: 32e5be8a6af7a11509d10fdde2d4852da8e8abca
  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.