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

helper/schema: Add Set.HashEqual #15819

Merged
merged 2 commits into from
Aug 16, 2017
Merged

helper/schema: Add Set.HashEqual #15819

merged 2 commits into from
Aug 16, 2017

Conversation

vancluever
Copy link
Contributor

Equality of schema.Sets gets tricky when dealing with nested sets -
Set.Equal only superficially compares the underlying maps and hence any
sets nested under the root sets cause issues.

This adds a simple method, HashEqual, that does a top-level hash
comparison, helping to work around this without any complex re-invention
of things like reflect.DeepEqual.

Of course, in order to make effective use of this function, the user
needs to make sure they are properly hashing their nested sets, however
this is trivial with things like HashResource.

Equality of schema.Sets gets tricky when dealing with nested sets -
Set.Equal only superficially compares the underlying maps and hence any
sets nested under the root sets cause issues.

This adds a simple method, HashEqual, that does a top-level hash
comparison, helping to work around this without any complex re-invention
of things like reflect.DeepEqual.

Of course, in order to make effective use of this function, the user
needs to make sure they are properly hashing their nested sets, however
this is trivial with things like HashResource.
Just to make sure equality on outer and inner values does not affect
anything.
@vancluever vancluever changed the title F schema set hashequal helper/schema: Add Set.HashEqual Aug 16, 2017
vancluever added a commit to hashicorp/terraform-provider-vsphere that referenced this pull request Aug 16, 2017
Note that this will break until hashicorp/terraform#15819 gets in as
many of the tests depend on Set.HashEqual to test the equality of
complex nested sets.
@vancluever vancluever merged commit 6ecf535 into master Aug 16, 2017
@vancluever vancluever deleted the f-schema-set-hashequal branch August 16, 2017 16:28
@vancluever
Copy link
Contributor Author

Thanks for the review @apparentlymart! 👍

vancluever added a commit to hashicorp/terraform-provider-vsphere that referenced this pull request Aug 18, 2017
Note that this will break until hashicorp/terraform#15819 gets in as
many of the tests depend on Set.HashEqual to test the equality of
complex nested sets.
@ghost
Copy link

ghost commented Apr 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants