Skip to content

remove legacy code#460

Merged
visualfc merged 5 commits into
goplus:mainfrom
visualfc:cleanimporter
May 14, 2026
Merged

remove legacy code#460
visualfc merged 5 commits into
goplus:mainfrom
visualfc:cleanimporter

Conversation

@visualfc

Copy link
Copy Markdown
Member

No description provided.

@fennoai

fennoai Bot commented May 14, 2026

Copy link
Copy Markdown

Code Review: remove go/importer

Overall: clean, correct removal of dead code.

Both defaultImpl types.Importer (in Importer) and importer types.Importer (in TypesLoader) were initialized with importer.Default() but never subsequently read. Removing them has no behavioral impact on package resolution.

Positive effects

  • Correctness: The Importer.Import() fallback chain already terminates at ErrNotFoundPackage without ever consulting defaultImpl; TypesLoader.Import similarly never called .importer. Removal is safe.
  • Security: Eliminating go/importer.Default() as an implicit fallback removes a potential uncontrolled filesystem read. Package resolution is now fully explicit and controlled.
  • Performance: importer.Default() initializes the GC importer (path resolution, module layout, internal caches) eagerly on every NewImporter/NewTypesLoader call. Removing this unconditional startup cost is a net win.

Minor observations (out-of-diff, non-blocking)

  1. context.go ~line 90 — The exported Importer field comment is just // importer. Now that go/importer.Default() is no longer a silent fallback, this field is the sole importer for the type checker and is always non-nil after NewContext. A brief godoc note to that effect would help callers who want to override it.

  2. xgobuild/build.go ~line 42–46 — The StaticLoad comment refers to "dynamic ixgo.Importer" implying the removed go/importer.Default() backend was the "dynamic" part. With that backend gone from ixgo.Importer entirely, the dynamic/static framing is less clear. Worth revisiting for accuracy.

  3. PR title claritygo/importer as a host-side dependency of ixgo is removed, but the package remains available to guest programs via the pkg/go/importer/ export stubs. The distinction may be worth a one-line commit note to avoid confusion in the git history.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the usage of the go/importer package and the types.Importer fields from the Importer and TypesLoader structs, as well as their corresponding initializations in NewImporter and NewTypesLoader. I have no feedback to provide as there were no review comments.

@visualfc visualfc changed the title remove go/importer remove legacy code May 14, 2026
@visualfc visualfc merged commit d04738a into goplus:main May 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant