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

tftypes: Added AttributePath LastStep method and AttributePathStep Equal method #112

Merged
merged 4 commits into from
Oct 6, 2021

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Sep 30, 2021

Closes #111

@bflad bflad added the enhancement New feature or request label Sep 30, 2021
@bflad bflad requested a review from a team September 30, 2021 13:26
Copy link
Contributor

@paddycarver paddycarver left a 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.

@@ -585,3 +641,38 @@ func TestAttributePathString(t *testing.T) {
})
}
}

func attributePathStepComparer(i, j AttributePathStep) bool {
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 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.

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 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.

Copy link
Contributor

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. :(

@bflad bflad changed the title tftypes: Added AttributePath LastStep method tftypes: Added AttributePath LastStep method and AttributePathStep Equal method Oct 5, 2021
@bflad bflad added this to the v0.5.0 milestone Oct 6, 2021
@bflad bflad merged commit d36cd4c into main Oct 6, 2021
@bflad bflad deleted the bflad-f-AttributePath-LastStep branch October 6, 2021 21:18
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tftypes: Consider (AttributePath).LastStep() Method
2 participants