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