Skip to content

Commit b411abd

Browse files
bweston92pepov
authored andcommitted
Rename argument new to newOrig
`new` is a function that Go provides globally this commit removes using it as a variable name. See other implementations within this codebase where they use alternative names https://github.com/banzaicloud/k8s-objectmatcher/blob/1596e84aae2764cab454a32215e756bbbee3af5d/pvc.go#L36
1 parent 1596e84 commit b411abd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pdb.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@ func NewPodDisruptionBudgetMatcher(objectMatcher ObjectMatcher) *podDisruptionBu
3232
}
3333

3434
// Match compares two autoscalev2beta1.HorizontalPodAutoscaler objects
35-
func (m podDisruptionBudgetMatcher) Match(old, new *policyv1beta1.PodDisruptionBudget) (bool, error) {
35+
func (m podDisruptionBudgetMatcher) Match(oldOrig, newOrig *policyv1beta1.PodDisruptionBudget) (bool, error) {
3636
type PodDisruptionBudgetMatcher struct {
3737
ObjectMeta
3838
Spec policyv1beta1.PodDisruptionBudgetSpec
3939
}
4040

4141
oldData, err := json.Marshal(PodDisruptionBudgetMatcher{
42-
ObjectMeta: m.objectMatcher.GetObjectMeta(old.ObjectMeta),
43-
Spec: old.Spec,
42+
ObjectMeta: m.objectMatcher.GetObjectMeta(oldOrig.ObjectMeta),
43+
Spec: oldOrig.Spec,
4444
})
4545
if err != nil {
46-
return false, emperror.WrapWith(err, "could not marshal old object", "name", old.Name)
46+
return false, emperror.WrapWith(err, "could not marshal old object", "name", oldOrig.Name)
4747
}
4848
newObject := PodDisruptionBudgetMatcher{
49-
ObjectMeta: m.objectMatcher.GetObjectMeta(new.ObjectMeta),
50-
Spec: new.Spec,
49+
ObjectMeta: m.objectMatcher.GetObjectMeta(newOrig.ObjectMeta),
50+
Spec: newOrig.Spec,
5151
}
5252
newData, err := json.Marshal(newObject)
5353
if err != nil {
54-
return false, emperror.WrapWith(err, "could not marshal new object", "name", new.Name)
54+
return false, emperror.WrapWith(err, "could not marshal new object", "name", newOrig.Name)
5555
}
5656

5757
matched, err := m.objectMatcher.MatchJSON(oldData, newData, newObject)
5858
if err != nil {
59-
return false, emperror.WrapWith(err, "could not match objects", "name", new.Name)
59+
return false, emperror.WrapWith(err, "could not match objects", "name", newOrig.Name)
6060
}
6161

6262
return matched, nil

0 commit comments

Comments
 (0)