aboutsummaryrefslogtreecommitdiff
path: root/src/go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2021-03-04 10:35:17 -0500
committerAlexander Rakoczy <alex@golang.org>2021-03-10 21:27:07 +0000
commit5993fbbd4853f4c6062980908c274bacb6f927dc (patch)
treea539c08749df2737c19d3203be6de8cd3d2d69ac /src/go
parent6e041884406421d329b9c6064f3c13104628c876 (diff)
downloadgo-5993fbbd4853f4c6062980908c274bacb6f927dc.tar.gz
go-5993fbbd4853f4c6062980908c274bacb6f927dc.zip
[release-branch.go1.16] 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. Includes test fix from CL 298794 Fixes #44746 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> (cherry picked from commit b87e9b9f68f1eb0d685fd250b3b47495710e0059) Reviewed-on: https://go-review.googlesource.com/c/go/+/298929
Diffstat (limited to 'src/go')
-rw-r--r--src/go/build/build_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/go/build/build_test.go b/src/go/build/build_test.go
index d8f264cac7..d13ea810a7 100644
--- a/src/go/build/build_test.go
+++ b/src/go/build/build_test.go
@@ -612,7 +612,7 @@ func TestImportPackageOutsideModule(t *testing.T) {
ctxt.GOPATH = gopath
ctxt.Dir = filepath.Join(gopath, "src/example.com/p")
- want := "working directory is not part of a module"
+ want := "go.mod file not found in current directory or any parent directory"
if _, err := ctxt.Import("example.com/p", gopath, FindOnly); err == nil {
t.Fatal("importing package when no go.mod is present succeeded unexpectedly")
} else if errStr := err.Error(); !strings.Contains(errStr, want) {