Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/cli/alpha/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type Generate struct {
OutputDir string
}

// Define a variable to allow overriding the behavior of getExecutablePath for testing.
var getExecutablePathFunc = getExecutablePath

// Generate handles the migration and scaffolding process.
func (opts *Generate) Generate() error {
projectConfig, err := common.LoadProjectConfig(opts.InputDir)
Expand Down Expand Up @@ -144,7 +147,7 @@ func (opts *Generate) Validate() error {
return fmt.Errorf("error getting input path %q: %w", opts.InputDir, err)
}

_, err = getExecutablePath()
_, err = getExecutablePathFunc()
if err != nil {
return err
}
Expand Down Expand Up @@ -188,7 +191,7 @@ func changeWorkingDirectory(outputDir string) error {
// Initializes the project with Kubebuilder.
func kubebuilderInit(s store.Store) error {
args := append([]string{"init"}, getInitArgs(s)...)
execPath, err := getExecutablePath()
execPath, err := getExecutablePathFunc()
if err != nil {
return err
}
Expand Down
Loading