Skip to content

Commit 80a5786

Browse files
Mikalai Radchukm1kola
authored andcommitted
Removes unnecessary constructor wrapper
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent 3d30ad0 commit 80a5786

File tree

1 file changed

+5
-12
lines changed
  • internal/resolution/variable_sources/olm

1 file changed

+5
-12
lines changed

internal/resolution/variable_sources/olm/olm.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input
2929

3030
// build required package variable sources
3131
for _, operator := range o.operators {
32-
rps, err := o.requiredPackageFromOperator(&operator)
32+
rps, err := required_package.NewRequiredPackage(
33+
operator.Spec.PackageName,
34+
required_package.InVersionRange(operator.Spec.Version),
35+
required_package.InChannel(operator.Spec.Channel),
36+
)
3337
if err != nil {
3438
return nil, err
3539
}
@@ -40,14 +44,3 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input
4044
variableSource := crd_constraints.NewCRDUniquenessConstraintsVariableSource(bundles_and_dependencies.NewBundlesAndDepsVariableSource(inputVariableSources...))
4145
return variableSource.GetVariables(ctx, entitySource)
4246
}
43-
44-
func (o *OLMVariableSource) requiredPackageFromOperator(operator *operatorsv1alpha1.Operator) (*required_package.RequiredPackageVariableSource, error) {
45-
var opts []required_package.RequiredPackageOption
46-
if operator.Spec.Version != "" {
47-
opts = append(opts, required_package.InVersionRange(operator.Spec.Version))
48-
}
49-
if operator.Spec.Channel != "" {
50-
opts = append(opts, required_package.InChannel(operator.Spec.Channel))
51-
}
52-
return required_package.NewRequiredPackage(operator.Spec.PackageName, opts...)
53-
}

0 commit comments

Comments
 (0)