diff options
author | Michael Matloob <matloob@golang.org> | 2021-06-28 15:48:03 -0400 |
---|---|---|
committer | Michael Matloob <matloob@golang.org> | 2021-07-30 22:29:52 +0000 |
commit | 47694b59eb30bfe6a1c12a2eaaf631a4e956b9c7 (patch) | |
tree | 37f2aa8c6b76c71f7241ca604dbc02261e2ab960 /src/cmd/go/testdata/script/work.txt | |
parent | 90830699aee61a154e989b2d9f8ce3ff4eabbce1 (diff) | |
download | go-47694b59eb30bfe6a1c12a2eaaf631a4e956b9c7.tar.gz go-47694b59eb30bfe6a1c12a2eaaf631a4e956b9c7.zip |
[dev.cmdgo] cmd/go: provide a more helpful missing required module error in workspaces
If the user is in a workspace, they might not be in the main module
they need to run go get from to add a module that provides a missing
dependency. Figure out what that module is from the import stack (there
might be multiple but we pick according to the stack computed by
the loader for errors) and tell the user to cd to that directory
first in the message.
Change-Id: I7c919eb61ea3dd122334ff1acd2d7e817cad4b25
Reviewed-on: https://go-review.googlesource.com/c/go/+/334940
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/testdata/script/work.txt')
-rw-r--r-- | src/cmd/go/testdata/script/work.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/testdata/script/work.txt b/src/cmd/go/testdata/script/work.txt index bcbabbacef..9be0958579 100644 --- a/src/cmd/go/testdata/script/work.txt +++ b/src/cmd/go/testdata/script/work.txt @@ -2,7 +2,7 @@ go mod initwork ./a ./b cmp go.work go.work.want ! go run example.com/b -stderr 'a(\\|/)a.go:4:8: no required module provides package rsc.io/quote; to add it:\n\tgo get rsc.io/quote' +stderr 'a(\\|/)a.go:4:8: no required module provides package rsc.io/quote; to add it:\n\tcd '$WORK(\\|/)gopath(\\|/)src(\\|/)a'\n\tgo get rsc.io/quote' cd a go get rsc.io/quote go env GOMOD # go env GOMOD reports the module in a single module context |