File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,11 @@ func runTidy(cmd *base.Command, args []string) {
44
44
45
45
// LoadALL adds missing modules.
46
46
// Remove unused modules.
47
- used := map [module.Version ]bool { modload . Target : true }
47
+ used := make ( map [module.Version ]bool )
48
48
for _ , pkg := range modload .LoadALL () {
49
49
used [modload .PackageModule (pkg )] = true
50
50
}
51
+ used [modload .Target ] = true // note: LoadALL initializes Target
51
52
52
53
inGoMod := make (map [string ]bool )
53
54
for _ , r := range modload .ModFile ().Require {
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ go list -m all
10
10
stdout '^w.1 v1.2.0'
11
11
stdout '^z.1 v1.2.0'
12
12
13
+ # empty tidy should not crash
14
+ cd triv
15
+ go mod tidy
16
+
13
17
-- go.mod --
14
18
module m
15
19
@@ -55,3 +59,6 @@ module z
55
59
56
60
-- z/sub/sub.go --
57
61
package sub
62
+
63
+ -- triv/go.mod --
64
+ module triv
You can’t perform that action at this time.
0 commit comments