Skip to content

Commit c840d7e

Browse files
author
Antoine Pelisse
committed
ManagedFields: Implement Copy method
1 parent ac8cf59 commit c840d7e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fieldpath/managers.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ func (lhs ManagedFields) Equals(rhs ManagedFields) bool {
8080
return true
8181
}
8282

83+
// Copy the list, this is mostly a shallow copy.
84+
func (lhs ManagedFields) Copy() ManagedFields {
85+
copy := ManagedFields{}
86+
for manager, set := range lhs {
87+
copy[manager] = set
88+
}
89+
return copy
90+
}
91+
8392
// Difference returns a symmetric difference between two Managers. If a
8493
// given user's entry has version X in lhs and version Y in rhs, then
8594
// the return value for that user will be from rhs. If the difference for

0 commit comments

Comments
 (0)