I have a SortSlices func like
cmpopts.SortSlices(func(a, b zpe.SwitchInterface) int {
return strings.Compare(a.ID, b.ID)
})
I get back a diff like
SwitchInterfaces: []zpe.SwitchInterface(Inverse(cmpopts.SortSlices, []zpe.SwitchInterface{
{
... // 16 identical fields
PortDescription: "interface_description",
MstpBpduGuard: "off",
- UntaggedVLAN: "",
+ UntaggedVLAN: "1",
TaggedVLAN: "",
AutoNegotiation: "",
},
{
... // 16 identical fields
PortDescription: "interface_description",
MstpBpduGuard: "off",
- UntaggedVLAN: "",
+ UntaggedVLAN: "1",
TaggedVLAN: "",
AutoNegotiation: "",
},
unfortunately the ID is now hidden in identical fields, but it is critical to understanding the diff. It would be nice if there was some utility option to always show a field in a diff for a type.
I envision an interface similar to cmpopts.IgnoreFields() but it guarentees a diff always will show a field if a diff exists for objects that match that type.