From a5c0b190809436fd196a348f85eca0416f4de7fe Mon Sep 17 00:00:00 2001 From: zhouguangyuan Date: Tue, 2 Nov 2021 20:23:34 +0800 Subject: [PATCH] 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 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Trust: Emmanuel Odeke --- src/cmd/go/testdata/script/mod_go_version_missing.txt | 2 +- src/go/build/build.go | 2 +- 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 { -- 2.48.1