diff
diff copied to clipboard
no differences reported for maps where values are empty structs
in a case where there is a type defined such as
type Set map[string]struct{}
the result of diffing these types always ends up with an empty changelog, even if there are differences on the keys
after digging a bit through the codebase I've realized that the structValues
method won't add any entry to the changelog if the struct has no fields; when diffing maps, for a specific key, if any of the maps doesn't have a value for that key, there is a shortcut that simply returns the output of structValues
as either create or delete depending which map is missing the data
this, effectively makes the changelog to be empty for the following case
a := Set{"existing": struct{}}
b := Set{}