Skip to content

Commit

Permalink
remove ctx
Browse files Browse the repository at this point in the history
Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan committed Oct 27, 2023
1 parent 94406d6 commit 156bf40
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewAnalyzeCmd(log logr.Logger) *cobra.Command {
return err
}
}
err := analyzeCmd.Validate(cmd.Context())
err := analyzeCmd.Validate()
if err != nil {
log.Error(err, "failed to validate flags")
return err
Expand Down Expand Up @@ -157,14 +157,14 @@ func NewAnalyzeCmd(log logr.Logger) *cobra.Command {
return analyzeCommand
}

func (a *analyzeCommand) Validate(ctx context.Context) error {
func (a *analyzeCommand) Validate() error {
if a.listSources || a.listTargets {
return nil
}
if a.labelSelector != "" && (len(a.sources) > 0 || len(a.targets) > 0) {
return fmt.Errorf("must not specify label-selector and sources or targets")
}
err := a.CheckOverwriteOutput(ctx)
err := a.CheckOverwriteOutput()
if err != nil {
return err
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (a *analyzeCommand) Validate(ctx context.Context) error {
return nil
}

func (a *analyzeCommand) CheckOverwriteOutput(ctx context.Context) error {
func (a *analyzeCommand) CheckOverwriteOutput() error {
// default overwrite to false so check for already existing output dir
stat, err := os.Stat(a.output)
if err != nil {
Expand All @@ -226,7 +226,7 @@ func (a *analyzeCommand) CheckOverwriteOutput(ctx context.Context) error {
}
}
if !a.overwrite && stat != nil {
return fmt.Errorf("output dir %v already exists", a.output)
return fmt.Errorf("output dir %v already exists and --overwrite not set", a.output)
}
if a.overwrite && stat != nil {
err := os.RemoveAll(a.output)
Expand Down

0 comments on commit 156bf40

Please sign in to comment.