From 80a5786d9a9335392d35e715b4956a93b9fd64c9 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Thu, 1 Jun 2023 10:57:10 +0100 Subject: [PATCH] Removes unnecessary constructor wrapper Signed-off-by: Mikalai Radchuk --- internal/resolution/variable_sources/olm/olm.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/internal/resolution/variable_sources/olm/olm.go b/internal/resolution/variable_sources/olm/olm.go index 97fae6f80..cc79c3b43 100644 --- a/internal/resolution/variable_sources/olm/olm.go +++ b/internal/resolution/variable_sources/olm/olm.go @@ -29,7 +29,11 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input // build required package variable sources for _, operator := range o.operators { - rps, err := o.requiredPackageFromOperator(&operator) + rps, err := required_package.NewRequiredPackage( + operator.Spec.PackageName, + required_package.InVersionRange(operator.Spec.Version), + required_package.InChannel(operator.Spec.Channel), + ) if err != nil { return nil, err } @@ -40,14 +44,3 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input variableSource := crd_constraints.NewCRDUniquenessConstraintsVariableSource(bundles_and_dependencies.NewBundlesAndDepsVariableSource(inputVariableSources...)) return variableSource.GetVariables(ctx, entitySource) } - -func (o *OLMVariableSource) requiredPackageFromOperator(operator *operatorsv1alpha1.Operator) (*required_package.RequiredPackageVariableSource, error) { - var opts []required_package.RequiredPackageOption - if operator.Spec.Version != "" { - opts = append(opts, required_package.InVersionRange(operator.Spec.Version)) - } - if operator.Spec.Channel != "" { - opts = append(opts, required_package.InChannel(operator.Spec.Channel)) - } - return required_package.NewRequiredPackage(operator.Spec.PackageName, opts...) -}