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

attr: Consider Dropping context.Context from Value Type() Method #521

Open
bflad opened this issue Oct 24, 2022 · 1 comment
Open

attr: Consider Dropping context.Context from Value Type() Method #521

bflad opened this issue Oct 24, 2022 · 1 comment
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. tech-debt Issues tracking technical debt that we're carrying.
Milestone

Comments

@bflad
Copy link
Member

bflad commented Oct 24, 2022

Module version

v0.14.0

Use-cases

attr.Value in the framework type system must be able to return their associated attr.Type. This is handled via the Type(context.Context) attr.Type method today. While the appropriate context.Context is generally available, there are places where it may not be, such as types package value creation functions.

Attempted Solutions

Either adding context.Context to all potential callers that may eventually call Type() or working around it via:

ctx := context.Background()
// ... Type(ctx) ...

Proposal

Type information should be very static and not require special logic where the context.Context is especially helpful (e.g. logging). Therefore, we may be able to drop the parameter to remove this awkwardness.

References

@bflad bflad added breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. tech-debt Issues tracking technical debt that we're carrying. labels Oct 24, 2022
@bflad
Copy link
Member Author

bflad commented Oct 24, 2022

Upstream terraform-plugin-go's (tftypes.Value).Type() does not require the context: https://pkg.go.dev/github.com/hashicorp/terraform-plugin-go@v0.14.0/tftypes#Value.Type

@bflad bflad added this to the v2.0.0 milestone Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. tech-debt Issues tracking technical debt that we're carrying.
Projects
None yet
Development

No branches or pull requests

1 participant