Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Jan 28, 2026

Overview

This PR refactors the NewCompiler method to use functional options, simplifying compiler initialization and improving flexibility.

Key Changes

  • Introduced functional options pattern for compiler configuration
  • Added new option methods like WithVerbose, WithEngineOverride, etc.
  • Updated tests to use new initialization pattern
  • Simplified default compiler creation logic
  • Removed redundant NewCompilerWithCustomOutput method
  • Maintained backward compatibility with NewCompilerWithVersion

Benefits

  • More flexible and readable compiler initialization
  • Easier to add new configuration options
  • Reduced method complexity
  • Better type safety and configuration management

Migration

  • Replace NewCompiler(false, "", "version") with NewCompilerWithVersion("version")
  • For more complex configurations, use functional options like NewCompiler(WithVerbose(true), WithEngineOverride("claude"))

Testing

  • Updated all existing tests to use new initialization pattern
  • Verified no breaking changes in compiler behavior

@dsyme
Copy link
Contributor Author

dsyme commented Jan 28, 2026

@copilot fix the go formatting CI failures

Copy link
Contributor

Copilot AI commented Jan 28, 2026

@dsyme I've opened a new pull request, #12335, to work on those changes. Once the pull request is ready, I'll request review from you.

@dsyme dsyme merged commit df27546 into main Jan 28, 2026
58 checks passed
@dsyme dsyme deleted the cu3 branch January 28, 2026 18:55
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.

2 participants