File tree Expand file tree Collapse file tree 2 files changed +755
-2
lines changed Expand file tree Collapse file tree 2 files changed +755
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ type Generate struct {
4242 OutputDir string
4343}
4444
45+ // Define a variable to allow overriding the behavior of getExecutablePath for testing.
46+ var getExecutablePathFunc = getExecutablePath
47+
4548// Generate handles the migration and scaffolding process.
4649func (opts * Generate ) Generate () error {
4750 projectConfig , err := common .LoadProjectConfig (opts .InputDir )
@@ -144,7 +147,7 @@ func (opts *Generate) Validate() error {
144147 return fmt .Errorf ("error getting input path %q: %w" , opts .InputDir , err )
145148 }
146149
147- _ , err = getExecutablePath ()
150+ _ , err = getExecutablePathFunc ()
148151 if err != nil {
149152 return err
150153 }
@@ -188,7 +191,7 @@ func changeWorkingDirectory(outputDir string) error {
188191// Initializes the project with Kubebuilder.
189192func kubebuilderInit (s store.Store ) error {
190193 args := append ([]string {"init" }, getInitArgs (s )... )
191- execPath , err := getExecutablePath ()
194+ execPath , err := getExecutablePathFunc ()
192195 if err != nil {
193196 return err
194197 }
You can’t perform that action at this time.
0 commit comments