x/vgo: Fix parsing of go.mod with packages from gopkg.in

This addresses an issue where Parsing of `go.mod` with modules from `gopkg.in` fails. The `go.mod` file is produced automatically, so the first time something like `vgo build` is run (before `go.mod` is created), it succeeds, but the second time it is run, it fails.

This fixes the latest issues described in https://github.com/golang/go/issues/24099

The funcs `parseGopkgIn` and `dotV` were pulled in (and slightly modified/simplified) from `vendor/cmd/go/internal/modfetch/gopkgin.go`.

I'm sure that this is not the best way to handle the special case of `gopkg.in` (especially compared to the effort put into creating the `VersionFixer`), but it's a starting point that has test cases that prove the autogenerated `go.mod` file can't be parsed.

Fixes #24099

Change-Id: Ie0bee2a50b330a9f85c1459ff6eb0bfa43058bf1
GitHub-Last-Rev: f60854418215026cdc3c9292a99e6dfd90557cd2
GitHub-Pull-Request: golang/vgo#4
Reviewed-on: https://go-review.googlesource.com/112277
Reviewed-by: Russ Cox <rsc@golang.org>
5 files changed
tree: d8e8e2c79c29b46f4ac1bf247fc26f26384d8533
  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.