cmd/go/internal/modfetch: fix bug in parsing non-quoted module paths

CL 105215 introduced "allow, prefer unquoted strings in mod files",
so autogenerated go.mod files do not contain quotes in the module path.

Before, `modPath` could only handle quoted module paths. This lead to
bugs like `vgo install github.com/Kyroy/vgoversion2/v2` installing
v1.0.0 instead of v2.1.0 because `isMajor` returned false instead of
true due to the wrong return of modPath. Hence, `findDir` returned
"missing go.mod" error.

Now, `modPath` is able to parse quoted and non-quoted module paths.

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