diff --git a/src/cmd/compile/internal/noder/reader2.go b/src/cmd/compile/internal/noder/reader2.go index cffa0372364..296d84289c5 100644 --- a/src/cmd/compile/internal/noder/reader2.go +++ b/src/cmd/compile/internal/noder/reader2.go @@ -43,7 +43,12 @@ func readPackage2(check *types2.Checker, imports map[string]*types2.Package, inp r.bool() // has init for i, n := 0, r.len(); i < n; i++ { - r.obj() + // As if r.obj(), but avoiding the Scope.Lookup call, + // to avoid eager loading of imports. + r.sync(syncObject) + assert(!r.bool()) + r.p.objIdx(r.reloc(relocObj)) + assert(r.len() == 0) } r.sync(syncEOF)