{"repo":"r3labs/diff","free":true,"listed":false,"github":"https://github.com/r3labs/diff","clone":"git clone https://github.com/r3labs/diff.git","description":"A library for diffing golang structures","language":"Go","stars":983,"topics":["diffing-golang-structures","diff","golang"],"license":"MPL-2.0","category":"dev-tools","readme_excerpt":"Diff A library for diffing golang structures and values. Utilizing field tags and reflection, it is able to compare two structures of the same type and create a changelog of all modified values. The produced changelog can easily be serialized to json. NOTE: All active development now takes place on the v3 branch. Installation For version 3: Changelog Format When diffing two structures using Diff , a changelog will be produced. Any detected changes will populate the changelog array with a Change type: Given the example below, we are diffing two slices where the third element has been removed: The resultant changelog should contain one change: Supported Types A diffable value can be/contain any of the following types: Type Supported ------------ --------- struct ✔ slice ✔ string ✔ int ✔ bool ✔ map ✔ pointer ✔ custom types ✔ Please see the docs for more supported types, options and features. Tags In order for struct fields to be compared, they must be tagged with a given name. All tag values are prefixed with diff . i.e. diff:\"items\" . Tag Usage ------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Excludes a value from being diffed identifier If you need to compare arrays by a matching identifier and not based on order, you can spec","default_branch":null,"files":null,"tree":[],"storefront":"/r/r3labs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/r3labs/diff/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}