Skip to content

Make GetAttribute use reflection #134

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

Closed
paddycarver opened this issue Sep 8, 2021 · 1 comment · Fixed by #167
Closed

Make GetAttribute use reflection #134

paddycarver opened this issue Sep 8, 2021 · 1 comment · Fixed by #167
Assignees
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. enhancement New feature or request reflection Issues and PRs about the reflection subsystem used to convert between attr.Values and Go values.
Milestone

Comments

@paddycarver
Copy link
Contributor

Module version

v0.2.0

Use-cases

See #46.

Attempted Solutions

#46

Proposal

Rather than having GetAttribute return an attr.Value, let's mirror Get and have it take a target interface{} that it reflects into. Otherwise, people are just going to need to use tfsdk.ValueOf or type-assert out of it anyways, so there's no real point in surfacing the attr.Value version. If people want the attr.Value, they can make target an attr.Value implementation, so I don't know that we lose anything here.

This lets us mirror #133 for reflect.Into and mirrors how SetAttribute works, so it just feels more consistent.

References

@paddycarver paddycarver added the enhancement New feature or request label Sep 8, 2021
@aareet aareet added the breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. label Sep 9, 2021
@bflad bflad self-assigned this Sep 17, 2021
bflad added a commit that referenced this issue Sep 17, 2021
@paddycarver paddycarver added the reflection Issues and PRs about the reflection subsystem used to convert between attr.Values and Go values. label Sep 21, 2021
bflad added a commit that referenced this issue Oct 4, 2021
bflad added a commit that referenced this issue Oct 28, 2021
@bflad bflad added this to the v0.5.0 milestone Oct 28, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. enhancement New feature or request reflection Issues and PRs about the reflection subsystem used to convert between attr.Values and Go values.
Projects
None yet
3 participants