From 32d051ceae59530521b3ecef933da6bce3ab2a7e Mon Sep 17 00:00:00 2001 From: weilaaa Date: Fri, 6 Aug 2021 10:34:17 +0800 Subject: [PATCH] remove duplicated constants in binding.go Signed-off-by: weilaaa --- pkg/util/helper/binding.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pkg/util/helper/binding.go b/pkg/util/helper/binding.go index a07fe0c83..30e89e124 100644 --- a/pkg/util/helper/binding.go +++ b/pkg/util/helper/binding.go @@ -26,13 +26,6 @@ import ( "github.com/karmada-io/karmada/pkg/util/restmapper" ) -const ( - // SpecField indicates the 'spec' field of a deployment - SpecField = "spec" - // ReplicasField indicates the 'replicas' field of a deployment - ReplicasField = "replicas" -) - // ClusterWeightInfo records the weight of a cluster type ClusterWeightInfo struct { ClusterName string @@ -396,12 +389,12 @@ func calculateReplicas(c client.Client, policy *v1alpha1.ReplicaSchedulingPolicy } func applyReplicaSchedulingPolicy(workload *unstructured.Unstructured, desireReplica int64) error { - _, ok, err := unstructured.NestedInt64(workload.Object, SpecField, ReplicasField) + _, ok, err := unstructured.NestedInt64(workload.Object, util.SpecField, util.ReplicasField) if err != nil { return err } if ok { - err := unstructured.SetNestedField(workload.Object, desireReplica, SpecField, ReplicasField) + err := unstructured.SetNestedField(workload.Object, desireReplica, util.SpecField, util.ReplicasField) if err != nil { return err }