suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
933 stars 136 forks source link

Explore Lint based or reflection based tests for struct equality changes #281

Open suyashkumar opened 1 year ago

suyashkumar commented 1 year ago

In #280, we introduced Equals() methods for most Dataset related structs, which greatly reduces time to check for equality of large datasets (useful in tests and elsewhere) vs. relying on reflection. However, we must take care that if these structs are modified, the Equals method is also updated. These structs should not change often, so enforcing it at code review for now and this isn't a super high priority. But one could imagine lint comment based rules to check for this or reflection based tests to autogenerate a small set of equal and unequal values for every struct field (and those would fail if a newly added struct field wasn't reflected in the Equals method).