aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhouguangyuan <zhouguangyuan.xian@gmail.com>2021-11-02 20:23:34 +0800
committerEmmanuel Odeke <emmanuel@orijtech.com>2022-01-30 02:29:51 +0000
commita5c0b190809436fd196a348f85eca0416f4de7fe (patch)
tree33f52fff8674c28812e9b42b734de62738022c39
parent122654739dce506364d10c450afcc36d7572922d (diff)
downloadgo-a5c0b190809436fd196a348f85eca0416f4de7fe.tar.gz
go-a5c0b190809436fd196a348f85eca0416f4de7fe.zip
cmd/go: fix error message when missing import
Fixes #48907 Change-Id: I504f846fc2ea655ba00aedb30f90847f938c347c Reviewed-on: https://go-review.googlesource.com/c/go/+/360615 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
-rw-r--r--src/cmd/go/testdata/script/mod_go_version_missing.txt2
-rw-r--r--src/go/build/build.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/go/testdata/script/mod_go_version_missing.txt b/src/cmd/go/testdata/script/mod_go_version_missing.txt
index d704816729..2159a1e4c0 100644
--- a/src/cmd/go/testdata/script/mod_go_version_missing.txt
+++ b/src/cmd/go/testdata/script/mod_go_version_missing.txt
@@ -27,7 +27,7 @@ cmp go.mod go.mod.orig
! go list -mod=vendor all
! stderr '^go: inconsistent vendoring'
-stderr 'cannot find package "\." in:\n\t.*[/\\]vendor[/\\]example.com[/\\]badedit$'
+stderr 'cannot find package "vendor/example.com/badedit" in:\n\t.*[/\\]vendor[/\\]example.com[/\\]badedit$'
# When we set -mod=mod, the go version should be updated immediately,
# to the current version, converting the requirements from eager to lazy.
diff --git a/src/go/build/build.go b/src/go/build/build.go
index 6f7260b78f..dce0304ba4 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -789,7 +789,7 @@ Found:
}
// package was not found
- return p, fmt.Errorf("cannot find package %q in:\n\t%s", path, p.Dir)
+ return p, fmt.Errorf("cannot find package %q in:\n\t%s", p.ImportPath, p.Dir)
}
if mode&FindOnly != 0 {