diff --git a/src/cmd/compile/internal/noder/unified.go b/src/cmd/compile/internal/noder/unified.go index 6bc23cc5f92..a5f09748387 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()