@@ -16,11 +16,11 @@ func mainModule() (dir string, packages map[string]struct{}, _ error) {
16
16
// especially on macOS, which has the default soft limit set to 256 (ulimit -nS).
17
17
// Since go1.19 the limit is automatically increased to the maximum allowed value;
18
18
// see https://github.com/golang/go/issues/46279 for details.
19
- cmd := [... ]string {"go" , "list" , "-f={{if and (not .Standard) .Module.Main}}{{.ImportPath}}{{end}}" , "all" }
19
+ args := []string {"go" , "list" , "-f={{if and (not .Standard) .Module.Main}}{{.ImportPath}}{{end}}" , "all" }
20
20
21
- out , err := exec .Command (cmd [0 ], cmd [1 :]... ).Output ()
21
+ out , err := exec .Command (args [0 ], args [1 :]... ).Output ()
22
22
if err != nil {
23
- return "" , nil , fmt .Errorf ("running `go list all `: %w" , err )
23
+ return "" , nil , fmt .Errorf ("running `%s `: %w" , strings . Join ( args , " " ) , err )
24
24
}
25
25
26
26
list := strings .Split (strings .TrimSpace (string (out )), "\n " )
@@ -31,9 +31,10 @@ func mainModule() (dir string, packages map[string]struct{}, _ error) {
31
31
packages [pkg + "_test" ] = struct {}{} // `*_test` packages belong to the main module, see issue #24.
32
32
}
33
33
34
- out , err = exec .Command ("go" , "list" , "-m" , "-f={{.Dir}}" ).Output ()
34
+ args = []string {"go" , "list" , "-m" , "-f={{.Dir}}" }
35
+ out , err = exec .Command (args [0 ], args [1 :]... ).Output ()
35
36
if err != nil {
36
- return "" , nil , fmt .Errorf ("running `go list -m `: %w" , err )
37
+ return "" , nil , fmt .Errorf ("running `%s `: %w" , strings . Join ( args , " " ) , err )
37
38
}
38
39
39
40
dir = strings .TrimSpace (string (out ))
0 commit comments