code review

This commit is contained in:
Donny Xia
2020-10-27 15:10:29 -07:00
parent bb77a7c86d
commit cd2ebd3046

View File

@@ -18,11 +18,11 @@ type Patch struct {
Target *Selector `json:"target,omitempty" yaml:"target,omitempty"`
}
// Equals return true if p equals another.
func (p *Patch) Equals(another Patch) bool {
targetEqual := (p.Target == another.Target) ||
(p.Target != nil && another.Target != nil && *p.Target == *another.Target)
return p.Path == another.Path &&
p.Patch == another.Patch &&
// Equals return true if p equals o.
func (p *Patch) Equals(o Patch) bool {
targetEqual := (p.Target == o.Target) ||
(p.Target != nil && o.Target != nil && *p.Target == *o.Target)
return p.Path == o.Path &&
p.Patch == o.Patch &&
targetEqual
}