@@ -18,82 +18,92 @@ var parseMetaGoImportsTests = []struct {
1818 {
1919 `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
2020 IgnoreMod ,
21- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
21+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
2222 },
2323 {
2424 `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
2525 <meta name="go-import" content="baz/quux git http://github.com/rsc/baz/quux">` ,
2626 IgnoreMod ,
2727 []metaImport {
28- {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" },
29- {"baz/quux" , "git" , "http://github.com/rsc/baz/quux" },
28+ {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" },
29+ {"baz/quux" , "git" , "http://github.com/rsc/baz/quux" , "" },
3030 },
3131 },
3232 {
3333 `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
3434 <meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">` ,
3535 IgnoreMod ,
3636 []metaImport {
37- {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" },
37+ {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" },
3838 },
3939 },
4040 {
4141 `<meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">
4242 <meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
4343 IgnoreMod ,
4444 []metaImport {
45- {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" },
45+ {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" },
4646 },
4747 },
4848 {
4949 `<meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">
5050 <meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
5151 PreferMod ,
5252 []metaImport {
53- {"foo/bar" , "mod" , "http://github.com/rsc/baz/quux" },
53+ {"foo/bar" , "mod" , "http://github.com/rsc/baz/quux" , "" },
5454 },
5555 },
5656 {
5757 `<head>
5858 <meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
5959 </head>` ,
6060 IgnoreMod ,
61- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
61+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
6262 },
6363 {
6464 `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
6565 <body>` ,
6666 IgnoreMod ,
67- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
67+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
6868 },
6969 {
7070 `<!doctype html><meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
7171 IgnoreMod ,
72- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
72+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
7373 },
7474 {
7575 // XML doesn't like <div style=position:relative>.
7676 `<!doctype html><title>Page Not Found</title><meta name=go-import content="chitin.io/chitin git https://github.com/chitin-io/chitin"><div style=position:relative>DRAFT</div>` ,
7777 IgnoreMod ,
78- []metaImport {{"chitin.io/chitin" , "git" , "https://github.com/chitin-io/chitin" }},
78+ []metaImport {{"chitin.io/chitin" , "git" , "https://github.com/chitin-io/chitin" , "" }},
7979 },
8080 {
8181 `<meta name="go-import" content="myitcv.io git https://github.com/myitcv/x">
8282 <meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">
8383 ` ,
8484 IgnoreMod ,
85- []metaImport {{"myitcv.io" , "git" , "https://github.com/myitcv/x" }},
85+ []metaImport {{"myitcv.io" , "git" , "https://github.com/myitcv/x" , "" }},
8686 },
8787 {
8888 `<meta name="go-import" content="myitcv.io git https://github.com/myitcv/x">
8989 <meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">
9090 ` ,
9191 PreferMod ,
9292 []metaImport {
93- {"myitcv.io/blah2" , "mod" , "https://raw.githubusercontent.com/myitcv/pubx/master" },
94- {"myitcv.io" , "git" , "https://github.com/myitcv/x" },
93+ {"myitcv.io/blah2" , "mod" , "https://raw.githubusercontent.com/myitcv/pubx/master" , "" },
94+ {"myitcv.io" , "git" , "https://github.com/myitcv/x" , "" },
9595 },
9696 },
97+ {
98+ `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar subdir">` ,
99+ IgnoreMod ,
100+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "subdir" }},
101+ },
102+ {
103+ `<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar subdir/path">` ,
104+ IgnoreMod ,
105+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "subdir/path" }},
106+ },
97107}
98108
99109func TestParseMetaGoImports (t * testing.T ) {
0 commit comments