Added features:
- (#108) The
_field is always ignored when comparing a struct. - (#109) The naming rules for
cmp.Transformeris relaxed and clearly specified. - (#82)
cmpopts.AcyclicTransformermakes it easier to write a transformer that avoids infinite recursion when the output type contains the input type. - (#126)
cmpopts.IgnoreSliceElementsandcmpopts.IgnoreMapEntriesprovide the ability to ignore specific slice elements or map entries. - (#123)
cmp.Reporterprovides users the ability to add custom difference reporters. - (#119)
cmp.PathStep.Valuesprovide the currentreflect.Valuefor thexandyarguments at that given path step.
Bug fixes:
- (#87) Fixed proper comparing of slices where one is a sub-slice of the other.
Reporter changes:
- (#124) The
cmp.Diffoutput has been completely re-written to provide a unified diff of the two Go objects as a literal in pseudo-Go syntax (example). - (#131) The default reporter has built-in heuristics to detect whether a string or a byte-slice looks like binary data or human readable text, and can provide more humanly readable differences in certain use-cases. For example, a string may be detecting as containing multiple lines of text, for which it will print the difference based on the lines.