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

Fixes Parent Relation Lookups #47

Merged
merged 9 commits into from
Aug 15, 2018
Merged

Conversation

plusplusben
Copy link
Contributor

Found a few bugs in the parent relation lookups. This should fix them.

@plusplusben plusplusben self-assigned this Aug 11, 2018
filter.go Outdated
return false
}
for i, childMatchValue := range childMatchValues {
if childMatchValue.Interface() != parentMatchValues[i].Interface() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made this mistake before but we probably shouldn't compare the underlying values through Interface(). It will panic if one of the values is a zero value. Also if childMatchValue.IsValid() is false (a zero value), then we should return false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, What do you think about checking "CanInterface" first. I think that should work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better!

@plusplusben plusplusben merged commit 4b20701 into master Aug 15, 2018
@plusplusben plusplusben deleted the fix-parent-relation-lookups branch August 15, 2018 20:35
@ghost ghost unassigned plusplusben Oct 25, 2019
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 this pull request may close these issues.

2 participants