Skip to content

Commit 6b8283b

Browse files
committed
estimate: fix for modules that don't have a root package
Some modules don't have any .go files in their root directory (e.g. github.com/autobrr/qui), which means they have no root package. This led to the error "no required module provides package foo" when trying to list the direct dependencies of the estimated module. To fix this, we now make sure to use "go list" in module mode using the "-m" option when looking for the module directory in the GOPATH.
1 parent a6fe7fa commit 6b8283b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

estimate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func get(gopath, repodir, repo, rev string) error {
8888
// getModuleDir returns the path of the directory containing a module for the
8989
// given GOPATH and repository dir values.
9090
func getModuleDir(gopath, repodir, module string) (string, error) {
91-
cmd := exec.Command("go", "list", "-f", "{{.Dir}}", module)
91+
cmd := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", module)
9292
cmd.Dir = repodir
9393
cmd.Stderr = os.Stderr
9494
cmd.Env = append([]string{

0 commit comments

Comments
 (0)