stretchr / testify

A toolkit with common assertions and mocks that plays nicely with the standard library
MIT License
22.52k stars 1.56k forks source link

assert: switch the diff library to go-diff #1546

Open mitioshi opened 4 months ago

mitioshi commented 4 months ago

Summary

This PR changes the diff library used in the assert package to go-diff.

Changes

the library used for diffing was replaced to go-diff/diffmatchpatch which is actively maintained and enables us to access structured diffs.

Motivation

See the parent PR for more context

difflib is no longer maintained and cannot be extended to modify the diff structure. We end up outputting whatever the library spews without being able to modify it easily. Having the access to the diff structure gives us a more fine-grained control over what we show to users. The initial motivation for this PR was to add colorized diffs to assert.Equal. Accessing the diff structure would make this task trivial

Related issues

Split from #1480 as per @dolmen's suggestion