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 {
42
42
OutputDir string
43
43
}
44
44
45
+ // Define a variable to allow overriding the behavior of getExecutablePath for testing.
46
+ var getExecutablePathFunc = getExecutablePath
47
+
45
48
// Generate handles the migration and scaffolding process.
46
49
func (opts * Generate ) Generate () error {
47
50
projectConfig , err := common .LoadProjectConfig (opts .InputDir )
@@ -144,7 +147,7 @@ func (opts *Generate) Validate() error {
144
147
return fmt .Errorf ("error getting input path %q: %w" , opts .InputDir , err )
145
148
}
146
149
147
- _ , err = getExecutablePath ()
150
+ _ , err = getExecutablePathFunc ()
148
151
if err != nil {
149
152
return err
150
153
}
@@ -188,7 +191,7 @@ func changeWorkingDirectory(outputDir string) error {
188
191
// Initializes the project with Kubebuilder.
189
192
func kubebuilderInit (s store.Store ) error {
190
193
args := append ([]string {"init" }, getInitArgs (s )... )
191
- execPath , err := getExecutablePath ()
194
+ execPath , err := getExecutablePathFunc ()
192
195
if err != nil {
193
196
return err
194
197
}
You can’t perform that action at this time.
0 commit comments