From: Cuong Manh Le Date: Wed, 3 Jul 2024 15:46:30 +0000 (+0700) Subject: cmd/compile: add comment for the context on mismatch import path X-Git-Tag: go1.24rc1~1319 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ab7435abd9db52732d2d1d3494aae669d91937f1;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Reviewed-by: Keith Randall Auto-Submit: Cuong Manh Le --- diff --git a/src/cmd/compile/internal/noder/unified.go b/src/cmd/compile/internal/noder/unified.go index 6bc23cc5f9..a5f0974838 100644 --- a/src/cmd/compile/internal/noder/unified.go +++ b/src/cmd/compile/internal/noder/unified.go @@ -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()