Skip to content

Commit

Permalink
fix: deepcopy
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
  • Loading branch information
vishal-chdhry committed Jul 4, 2024
1 parent 45d5e86 commit e709689
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions pkg/api/cephr.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,16 @@ func (c *cephrStore) Watch(ctx context.Context, options *metainternalversion.Lis
}
events := make([]watch.Event, len(list.Items))
for i, pol := range list.Items {
report := pol.DeepCopy()
if pol.Generation == 1 || pol.Generation == 0 {
events[i] = watch.Event{
Type: watch.Added,
Object: &pol,
Object: report,
}
} else {
events[i] = watch.Event{
Type: watch.Modified,
Object: &pol,
Object: report,
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/cpolr.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,16 @@ func (c *cpolrStore) Watch(ctx context.Context, options *metainternalversion.Lis
}
events := make([]watch.Event, len(list.Items))
for i, pol := range list.Items {
report := pol.DeepCopy()
if pol.Generation == 1 || pol.Generation == 0 {
events[i] = watch.Event{
Type: watch.Added,
Object: &pol,
Object: report,
}
} else {
events[i] = watch.Event{
Type: watch.Modified,
Object: &pol,
Object: report,
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/ephr.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,16 @@ func (p *ephrStore) Watch(ctx context.Context, options *metainternalversion.List
}
events := make([]watch.Event, len(list.Items))
for i, pol := range list.Items {
report := pol.DeepCopy()
if pol.Generation == 1 || pol.Generation == 0 {
events[i] = watch.Event{
Type: watch.Added,
Object: &pol,
Object: report,
}
} else {
events[i] = watch.Event{
Type: watch.Modified,
Object: &pol,
Object: report,
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/polr.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,16 @@ func (p *polrStore) Watch(ctx context.Context, options *metainternalversion.List
}
events := make([]watch.Event, len(list.Items))
for i, pol := range list.Items {
report := pol.DeepCopy()
if pol.Generation == 1 || pol.Generation == 0 {
events[i] = watch.Event{
Type: watch.Added,
Object: &pol,
Object: report,
}
} else {
events[i] = watch.Event{
Type: watch.Modified,
Object: &pol,
Object: report,
}
}
}
Expand Down

0 comments on commit e709689

Please sign in to comment.