@@ -18,82 +18,92 @@ var parseMetaGoImportsTests = []struct {
18
18
{
19
19
`<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
20
20
IgnoreMod ,
21
- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
21
+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
22
22
},
23
23
{
24
24
`<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
25
25
<meta name="go-import" content="baz/quux git http://github.com/rsc/baz/quux">` ,
26
26
IgnoreMod ,
27
27
[]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" , "" },
30
30
},
31
31
},
32
32
{
33
33
`<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
34
34
<meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">` ,
35
35
IgnoreMod ,
36
36
[]metaImport {
37
- {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" },
37
+ {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" },
38
38
},
39
39
},
40
40
{
41
41
`<meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">
42
42
<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
43
43
IgnoreMod ,
44
44
[]metaImport {
45
- {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" },
45
+ {"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" },
46
46
},
47
47
},
48
48
{
49
49
`<meta name="go-import" content="foo/bar mod http://github.com/rsc/baz/quux">
50
50
<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
51
51
PreferMod ,
52
52
[]metaImport {
53
- {"foo/bar" , "mod" , "http://github.com/rsc/baz/quux" },
53
+ {"foo/bar" , "mod" , "http://github.com/rsc/baz/quux" , "" },
54
54
},
55
55
},
56
56
{
57
57
`<head>
58
58
<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
59
59
</head>` ,
60
60
IgnoreMod ,
61
- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
61
+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
62
62
},
63
63
{
64
64
`<meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">
65
65
<body>` ,
66
66
IgnoreMod ,
67
- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
67
+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
68
68
},
69
69
{
70
70
`<!doctype html><meta name="go-import" content="foo/bar git https://github.com/rsc/foo/bar">` ,
71
71
IgnoreMod ,
72
- []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" }},
72
+ []metaImport {{"foo/bar" , "git" , "https://github.com/rsc/foo/bar" , "" }},
73
73
},
74
74
{
75
75
// XML doesn't like <div style=position:relative>.
76
76
`<!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>` ,
77
77
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" , "" }},
79
79
},
80
80
{
81
81
`<meta name="go-import" content="myitcv.io git https://github.com/myitcv/x">
82
82
<meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">
83
83
` ,
84
84
IgnoreMod ,
85
- []metaImport {{"myitcv.io" , "git" , "https://github.com/myitcv/x" }},
85
+ []metaImport {{"myitcv.io" , "git" , "https://github.com/myitcv/x" , "" }},
86
86
},
87
87
{
88
88
`<meta name="go-import" content="myitcv.io git https://github.com/myitcv/x">
89
89
<meta name="go-import" content="myitcv.io/blah2 mod https://raw.githubusercontent.com/myitcv/pubx/master">
90
90
` ,
91
91
PreferMod ,
92
92
[]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" , "" },
95
95
},
96
96
},
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
+ },
97
107
}
98
108
99
109
func TestParseMetaGoImports (t * testing.T ) {
0 commit comments