Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no differences reported for maps where values are empty structs #100

Open
aexvir opened this issue Mar 8, 2023 · 0 comments · May be fixed by #101
Open

no differences reported for maps where values are empty structs #100

aexvir opened this issue Mar 8, 2023 · 0 comments · May be fixed by #101

Comments

@aexvir
Copy link

aexvir commented Mar 8, 2023

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{}
@aexvir aexvir changed the title no differences reported for maps where only keys have value no differences reported for maps where values are empty structs Mar 8, 2023
@aexvir aexvir linked a pull request Mar 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant