gosrc: add minimal support for vgo-aware modules

Currently, gddo assumes that there will be just one go-import HTML meta
tag when resolving a custom import's VCS repository. vgo introduces a
special new go-import meta tag to identify the location of published Go
modules; it has the VCS identifier 'mod'.

https://golang.org/issue/25140 and https://golang.org/issue/25139 added
minimal awareness to the Go 1.9 and 1.10 branches for the vgo transition
that will start in Go 1.11. Part of this backported support is to ignore
the module special go-import meta tag which has a 'mod' vcvs type:

https://go-review.googlesource.com/c/go/+/115298/4/src/cmd/go/internal/get/discovery.go

Per https://golang.org/issue/25069, the 'mod' vcs type is used by 'new'
Go code to identify where published modules can be fetched.

As a first minimal step we can make gddo "aware" in the same way that Go
1.9 and 1.10 are "aware" of these published modules by simply ignoring
that go-import meta tag.

Later gddo CLs will likely need to enhance support for vgo, but this is
a sufficient first step.

Fixes #558

Change-Id: Ibddfcc8e0a663792da206a244e5cffb8c68fe894
Reviewed-on: https://go-review.googlesource.com/120817
Reviewed-by: Tuo Shan <shantuo@google.com>
diff --git a/gosrc/gosrc.go b/gosrc/gosrc.go
index 38005ec..9a9e44b 100644
--- a/gosrc/gosrc.go
+++ b/gosrc/gosrc.go
@@ -302,6 +302,10 @@
 					errorMessage = "go-import meta tag content attribute does not have three fields"
 					continue metaScan
 				}
+				if fields[1] == "mod" {
+					// vgo adds a special mod vcs type; we can skip this
+					continue
+				}
 				if im != nil {
 					im = nil
 					errorMessage = "more than one go-import meta tag found"
diff --git a/gosrc/gosrc_test.go b/gosrc/gosrc_test.go
index 9213e62..be4acde 100644
--- a/gosrc/gosrc_test.go
+++ b/gosrc/gosrc_test.go
@@ -86,6 +86,14 @@
 		`<meta name="go-source" content="azul3d.org/examples https://github.com/azul3d/examples https://gotools.org/azul3d.org/examples{/dir} https://gotools.org/azul3d.org/examples{/dir}#{file}-L{line}">` +
 		`<meta http-equiv="refresh" content="0; url=https://godoc.org/azul3d.org/examples/abs">` +
 		`</head>`,
+
+	// Multiple go-import meta tags; one of which is a vgo-special mod vcs type
+	"http://myitcv.io/blah2": `<!DOCTYPE html><html><head>` +
+		`<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>` +
+		`<meta name="go-import" content="myitcv.io/blah2 git https://github.com/myitcv/x">` +
+		`<meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">` +
+		`<meta name="go-source" content="myitcv.io https://github.com/myitcv/x/wiki https://github.com/myitcv/x/tree/master{/dir} https://github.com/myitcv/x/blob/master{/dir}/{file}#L{line}">` +
+		`</head>`,
 }
 
 var getDynamicTests = []struct {
@@ -202,6 +210,17 @@
 		VCS:          "git",
 		Files:        []*File{{Name: "main.go", BrowseURL: "https://gotools.org/azul3d.org/examples/abs#main.go"}},
 	}},
+	{"myitcv.io/blah2", &Directory{
+		BrowseURL:    "https://github.com/myitcv/x",
+		ImportPath:   "myitcv.io/blah2",
+		LineFmt:      "%s#L%d",
+		ProjectName:  "blah2",
+		ProjectRoot:  "myitcv.io/blah2",
+		ProjectURL:   "http://myitcv.io/blah2",
+		ResolvedPath: "github.com/myitcv/x",
+		VCS:          "git",
+		Files:        []*File{{Name: "main.go", BrowseURL: "https://github.com/myitcv/x/blob/master/main.go"}},
+	}},
 }
 
 type testTransport map[string]string