diff --git a/pkg/flag/options.go b/pkg/flag/options.go index 8f15480ccfec..70470dc05e2f 100644 --- a/pkg/flag/options.go +++ b/pkg/flag/options.go @@ -364,8 +364,10 @@ type Options struct { } // Align takes consistency of options -func (o *Options) Align() error { - o.enableSBOM() +func (o *Options) Align(f *Flags) error { + if f.ScanFlagGroup != nil && f.ScanFlagGroup.Scanners != nil { + o.enableSBOM() + } if o.Compliance.Spec.ID != "" { if viper.IsSet(ScannersFlag.ConfigName) { @@ -749,7 +751,7 @@ func (f *Flags) ToOptions(args []string) (Options, error) { } } - if err := opts.Align(); err != nil { + if err := opts.Align(f); err != nil { return Options{}, xerrors.Errorf("align options error: %w", err) }