1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:54:46 -07:00

cmd/compile: add comment for the context on mismatch import path

Follow up suggestion in CL 596396.

Updates #54542

Change-Id: I47bf66684bb8397dc1cfbc4479e2279e59a40cfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/596515
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Cuong Manh Le 2024-07-03 22:46:30 +07:00 committed by Gopher Robot
parent 34ddde165d
commit ab7435abd9

View File

@ -404,6 +404,7 @@ func readPackage(pr *pkgReader, importpkg *types.Pkg, localStub bool) {
r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
pkg := r.pkg()
// This error can happen if "go tool compile" is called with wrong "-p" flag, see issue #54542.
if pkg != importpkg {
base.ErrorfAt(base.AutogeneratedPos, errors.BadImportPath, "mismatched import path, have %q (%p), want %q (%p)", pkg.Path, pkg, importpkg.Path, importpkg)
base.ErrorExit()