-
Notifications
You must be signed in to change notification settings - Fork 33
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
tftypes: Added AttributePath LastStep method and AttributePathStep Equal method #112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small change to some supporting code, but otherwise seems reasonable to me.
tftypes/attribute_path_test.go
Outdated
@@ -585,3 +641,38 @@ func TestAttributePathString(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func attributePathStepComparer(i, j AttributePathStep) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying to implement an Equal
method on these that cmp
will pick up automatically, rather than defining comparers for them. Mostly because the comparers will need to be explicitly included everywhere, and it's hard to keep track of which you need. Equal
works everywhere without needing to be explicitly included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know that we're generally okay with expanding our compatibility surface area with Equal()
methods. I think its low risk, but didn't want to presume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in this case it was a no-brainer to me because the interface was intentionally unfulfillable and was less of an interface and more of an enum. So consumers of the package have no real impact as a result of this change.
For other things I give it a bit more consideration, but even then I usually end up siding with including it (see the framework's attr.Value
and attr.Type
). No hard and fast rules, unfortunately. :(
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #111