...
1
2
3
4 package types
5
6 import "reflect"
7
8
9
10
11
12 type Patch struct {
13
14 Path string `json:"path,omitempty" yaml:"path,omitempty"`
15
16
17 Patch string `json:"patch,omitempty" yaml:"patch,omitempty"`
18
19
20 Target *Selector `json:"target,omitempty" yaml:"target,omitempty"`
21
22
23 Options map[string]bool `json:"options,omitempty" yaml:"options,omitempty"`
24 }
25
26
27 func (p *Patch) Equals(o Patch) bool {
28 targetEqual := (p.Target == o.Target) ||
29 (p.Target != nil && o.Target != nil && *p.Target == *o.Target)
30 return p.Path == o.Path &&
31 p.Patch == o.Patch &&
32 targetEqual &&
33 reflect.DeepEqual(p.Options, o.Options)
34 }
35
View as plain text