func (lhs ManagedFields) Difference(rhs ManagedFields) ManagedFields {
	diff := ManagedFields{}
	for manager, left := range lhs {
		right, ok := rhs[manager]
		if !ok {
			if !left.Set().Empty() {
				diff[manager] = left
			}
			continue
		}
		if left.APIVersion() != right.APIVersion() {
			diff[manager] = right
			continue
		}
		newSet := left.Set().Difference(right.Set()).Union(right.Set().Difference(left.Set()))
		if !newSet.Empty() {
			diff[manager] = NewVersionedSet(newSet, right.APIVersion(), false)
		}
	}
	for manager, set := range rhs {
		if _, ok := lhs[manager]; ok {
			continue
		}
		if !set.Set().Empty() {
			diff[manager] = set
		}
	}
	return diff
}
Difference returns a symmetric difference between two Managers. If a
given user's entry has version X in lhs and version Y in rhs, then
the return value for that user will be from rhs. If the difference for
a user is an empty set, that user will not be inserted in the map.
package fieldpath
import (
	"fmt"
	"strings"
)
type APIVersion string
type VersionedSet interface {
	Set() *Set
	APIVersion() APIVersion
	Applied() bool
}
type versionedSet struct {
	set        *Set
	apiVersion APIVersion
	applied    bool
}
func NewVersionedSet(set *Set, apiVersion APIVersion, applied bool) VersionedSet {
	return versionedSet{
		set:        set,
		apiVersion: apiVersion,
		applied:    applied,
	}
}
func (v versionedSet) Set() *Set {
	return v.set
}
func (v versionedSet) APIVersion() APIVersion {
	return v.apiVersion
}
func (v versionedSet) Applied() bool {
	return v.applied
}
type ManagedFields map[string]VersionedSet
func (lhs ManagedFields) Equals(rhs ManagedFields) bool {
	if len(lhs) != len(rhs) {
		return false
	}
	for manager, left := range lhs {
		right, ok := rhs[manager]
		if !ok {
			return false
		}
		if left.APIVersion() != right.APIVersion() || left.Applied() != right.Applied() {
			return false
		}
		if !left.Set().Equals(right.Set()) {
			return false
		}
	}
	return true
}
func (lhs ManagedFields) Copy() ManagedFields {
	copy := ManagedFields{}
	for manager, set := range lhs {
		copy[manager] = set
	}
	return copy
}