diff options
author | Jay Conrod <jayconrod@google.com> | 2021-03-04 10:35:17 -0500 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2021-03-04 22:41:34 +0000 |
commit | b87e9b9f68f1eb0d685fd250b3b47495710e0059 (patch) | |
tree | 38eff73215ed1f8124c7d53c95e1e32897d212d0 /src/cmd/go/internal/modload/list.go | |
parent | a99ff24a26939f30440dd0f06dce426ed5e638ee (diff) | |
download | go-b87e9b9f68f1eb0d685fd250b3b47495710e0059.tar.gz go-b87e9b9f68f1eb0d685fd250b3b47495710e0059.zip |
cmd/go: clarify errors for commands run outside a module
The new error message tells the user what was wrong (no go.mod found)
and directs them to 'go help modules', which links to tutorials.
Fixes #44745
Change-Id: I98f31fec4a8757eb1792b45491519da4c552cb0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/298650
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/list.go')
-rw-r--r-- | src/cmd/go/internal/modload/list.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go index 6dba6bea22..c7ef8c9fb7 100644 --- a/src/cmd/go/internal/modload/list.go +++ b/src/cmd/go/internal/modload/list.go @@ -73,7 +73,7 @@ func listModules(ctx context.Context, args []string, listVersions, listRetracted base.Fatalf("go: cannot use relative path %s to specify module", arg) } if !HasModRoot() && (arg == "all" || strings.Contains(arg, "...")) { - base.Fatalf("go: cannot match %q: working directory is not part of a module", arg) + base.Fatalf("go: cannot match %q: %v", arg, ErrNoModRoot) } if i := strings.Index(arg, "@"); i >= 0 { path := arg[:i] |