Skip to content

fix: template for random_factory imports unnecessarily#666

Merged
stephenafamo merged 2 commits intostephenafamo:mainfrom
jay-babu:codex/random-factory-imports
May 4, 2026
Merged

fix: template for random_factory imports unnecessarily#666
stephenafamo merged 2 commits intostephenafamo:mainfrom
jay-babu:codex/random-factory-imports

Conversation

@jay-babu
Copy link
Copy Markdown
Contributor

@jay-babu jay-babu commented May 3, 2026

What changed

This narrows the random factory template import condition so it only imports when the generated code actually needs the dependency.

Why

The previous template condition could include an unnecessary import in generated random factory code.

Validation

  • go test ./gen

@jay-babu jay-babu marked this pull request as ready for review May 3, 2026 17:01
Copilot AI review requested due to automatic review settings May 3, 2026 17:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the bobfactory_random template logic so type imports are only added when a random expression is actually emitted, avoiding unused imports in generated random factory code.

Changes:

  • Move $.Types.Get (which triggers type imports) to occur only after confirming RandomExpr exists for the type.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stephenafamo
Copy link
Copy Markdown
Owner

Add a note to CHANGELOG.md

@jay-babu
Copy link
Copy Markdown
Contributor Author

jay-babu commented May 3, 2026

@stephenafamo done

@stephenafamo stephenafamo merged commit edc7e71 into stephenafamo:main May 4, 2026
8 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.

4 participants