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

Backport of go.mod: go get github.com/zclconf/go-cty@v1.11.0 into v1.2 #31676

Merged
merged 2 commits into from Aug 23, 2022

Conversation

teamterraform
Copy link
Contributor

Backport

This PR is auto-generated from #31675 to be assessed for backporting due to the inclusion of the label 1.2-backport.

WARNING automatic cherry-pick of commits failed. Commits will require human attention.

The below text is copied from the body of the original PR.


This fixes a possible panic in what Terraform calls the "flatten" function in situations where a user passes in a null value of a sequence type. The function will now treat that the same as a null value of any other type.

This also includes some other changes that would benefit Terraform:

  • cty: Improved performance when comparing nonzero numbers to zero, by performing a relatively-cheap sign check on both numbers before falling back on the more expensive general equality implementation. (#125)
  • convert: Unify will no longer panic when asked to find a common base type for a tuple type and a list of unknown element type, and will instead just signal that such a unification is not possible. (#126)

Also notable is that this new release of cty now requires Go 1.18 or later. That's okay for backport into Terraform v1.2, since that release already uses Go 1.18, but this would not be backportable to older Terraform CLI releases. Our backport policy doesn't typically require us to go back further than one minor release anyway (aside from exceptional cases such as security advisories) and so I think this is a moot point, but I mention it for completeness.

Fixes #31376.

@teamterraform teamterraform force-pushed the backport/b-flatten-panic/cheaply-devoted-akita branch from 25c95e0 to 9980028 Compare August 22, 2022 18:10
@hashicorp-cla
Copy link

hashicorp-cla commented Aug 22, 2022

CLA assistant check
All committers have signed the CLA.

@apparentlymart
Copy link
Member

The version of stringer we're currently using on the v1.2 branch seems to be too old to have golang/go#51629 fixed, so I'm also going to update to the latest stringer release here so that go generate can still succeed even though we now have a package which is using type parameters in our dependency graph. (It seems like this would've happened the first time we introduced any dependency using type parameters; just coincidence that go-cty happened to be the first one.)

This gets us a sufficiently-new "stringer" tool that it's able to work
when there are packages in our dependency graph that use Go 1.18 type
parameters.

Without this, we will see the following error the first time we introduce
any dependency that uses type parameters, even if that dependency isn't
involved in our "stringer-ing".
    stringer: Unexpected package creation during export data loading
This fixes a possible panic in what Terraform calls the "flatten" function
in situations where a user passes in a null value of a sequence type.
The function will now treat that the same as a null value of any other
type.
@apparentlymart
Copy link
Member

Since this ended up being more than just a trivial backport I'm going to request code review in case someone knows of a reason we might not want to upgrade these various golang.org/x/... modules that came in as a side-effect of upgrading golang.org/x/tools to get a working stringer.

I don't see anything immediately concerning and those modules are have typically been conservative in their changes in the past, but with it not being the Go standard library and therefore not subject to the 1.0 Compatibility Promises I have a certain unease about it even though the tests are all still passing. 😖

@apparentlymart apparentlymart requested review from a team and removed request for apparentlymart August 22, 2022 19:39
@apparentlymart apparentlymart self-assigned this Aug 22, 2022
@apparentlymart apparentlymart merged commit 9b49372 into v1.2 Aug 23, 2022
@apparentlymart apparentlymart deleted the backport/b-flatten-panic/cheaply-devoted-akita branch August 23, 2022 20:59
@github-actions
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@github-actions
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 Sep 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants