]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix error message when missing import
authorzhouguangyuan <zhouguangyuan.xian@gmail.com>
Tue, 2 Nov 2021 12:23:34 +0000 (20:23 +0800)
committerEmmanuel Odeke <emmanuel@orijtech.com>
Sun, 30 Jan 2022 02:29:51 +0000 (02:29 +0000)
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>

src/cmd/go/testdata/script/mod_go_version_missing.txt
src/go/build/build.go

index d704816729b8c30e64bb64fd04e234ab3e829a5c..2159a1e4c0ee5ec0f60fc1ca5d3ebca6fd4e2fd5 100644 (file)
@@ -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.
index 6f7260b78f37ca490a01892123397ba9f626a63c..dce0304ba48cc5e9a8c5a3aae3bdea21fa70b27f 100644 (file)
@@ -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 {