]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: add comment for the context on mismatch import path
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 3 Jul 2024 15:46:30 +0000 (22:46 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 31 Jul 2024 19:54:27 +0000 (19:54 +0000)
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>

src/cmd/compile/internal/noder/unified.go

index 6bc23cc5f922742b684455350749074df0ce20df..a5f0974838752fa6e3e2ab94267258455f0209a4 100644 (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()