cmd/go/internal/modfile: allow replace without old version

Replace directives to date have looked like

	replace old v1.2.3 => new v1.4.5

As pointed out in golang/go#24825, this can result in fragile go.mod
where the replacement stops kicking in after an upgrade that
affects the selected old version.

The fact that the replacement specifies exactly which version
it is capable of replacing might be a feature, but in other contexts
it's just a hassle. Allow not specifying the version, in which case
the replacement applies to all versions of that module.

Fixes golang/go#24825.

Change-Id: Iad97dde25c06fcba3c1181d650f9fa5e95f83157
Reviewed-on: https://go-review.googlesource.com/122400
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: 481231e16d32e60c0baa1b17aa39a0a7459637f6
  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.