cmd/go/internal/modfetch: make gopkg.in support more seamless

Gopkg.in did semantic import versioning first.
We should make it as easy as possible for users
of gopkg.in to migrate to vgo.

Before this CL, gopkg.in was supported as a special
kind of code fetcher that rewrote tags to add a funny
prefix, so that gopkg.in/russross/blackfriday.v2 v2.0.0
showed up in go.mod as

	gopkg.in/russross/blackfriday.v2 v1.0.0-gopkgin-v2.0.0

This was needed because by the usual module path syntax
rules, gopkg.in/russross/blackfriday.v2 should be a v1 of
a package. But it's rather mysterious.

Instead, as a nod to gopkg.in being here first, this CL changes
the module path syntax rules to understand the version ranges
for a given gopkg.in path, allowing the expected:

	gopkg.in/russross/blackfriday.v2 v2.0.0

It even supports .v1 paths correctly.

The version fixer recognizes the old v1.0.0-gopkgin-v2.0.0
and turns it into plain v2.0.0.

Fixes golang/go#23991.
Fixes golang/go#24099.

Change-Id: I579863c2d36780bd1e9f1b786f41560bd774d8e3
Reviewed-on: https://go-review.googlesource.com/107658
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 files changed
tree: c9aba1c24e239108f67af82421c22f6bb786ba9a
  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.