Skip to content
Browse files

gps: ignore "mod" VCS type in parseMetaGoImports

Apply the same change as in to this copy of the
parseMetaGoImports function, helping keep them in sync.

The "mod" type is not a real version control system (VCS), it applies
only when in module mode. Skip it and continue to consider only real
VCS types.

This resolves parseMetaGoImports returning a "multiple meta tags match
import path" error on packages that offer go-import meta tags with both
a true VCS and the "mod" type.


Fixes #2151
  • Loading branch information...
dmitshur committed May 7, 2019
1 parent 66ec1e8 commit 21c40aae85d627927a6939f6268db3d24fb63e17
Showing with 7 additions and 0 deletions.
  1. +7 −0 gps/discovery.go
@@ -35,6 +35,9 @@ type metaImport struct {

// parseMetaGoImports returns meta imports from the HTML in r.
// Parsing ends at the end of the <head> section or the beginning of the <body>.
// This copy of cmd/go/internal/vcs.parseMetaGoImports always operates
// in IgnoreMod ModuleMode.
func parseMetaGoImports(r io.Reader) (imports []metaImport, err error) {
d := xml.NewDecoder(r)
d.CharsetReader = charsetReader
@@ -62,6 +65,10 @@ func parseMetaGoImports(r io.Reader) (imports []metaImport, err error) {
if f := strings.Fields(attrValue(e.Attr, "content")); len(f) == 3 {
// Ignore VCS type "mod", which is applicable only in module mode.
if f[1] == "mod" {
imports = append(imports, metaImport{
Prefix: f[0],
VCS: f[1],

0 comments on commit 21c40aa

Please sign in to comment.
You can’t perform that action at this time.