Skip to content

update go-cty@v1.18#38270

Merged
jbardin merged 3 commits intomainfrom
jbardin/update-cty
Mar 12, 2026
Merged

update go-cty@v1.18#38270
jbardin merged 3 commits intomainfrom
jbardin/update-cty

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Mar 12, 2026

Update go-cty to the latest release. From the CHANGELOG:

1.18.0 (February 23, 2026)

cty now requires Go 1.25 or later.

  • cty.Value.Equals now has a special case where if a null value is compared with a non-null value then only top-level marks from the non-null value will transfer to the boolean result.

    This is a limited introduction of the idea that only the parts of a nested data structure that were actually relevant to the comparison should transfer to the result. The more general form of that idea might follow in a later release, but that would require some more severe refactoring of this method's implementation that would be far riskier and so this is a pragmatic compromise to support just the relatively-common case of comparing with null in callers like HCL where an equality test is the canonical way to test a value for "null-ness".

  • cty.IndexStep.Apply now works for traversing through a set.

    Although cty.Value.Index does not allow looking up a set element due to set elements not having indices, we often use cty.Path to describe a specific location in a nested structure and have a convention of handling traversal through a set as a cty.IndexStep whose "key" is the set element's value.

    To make that work a little better with code that uses cty.Path.Apply on such paths, cty.IndexStep now has a special case where if the given value is a set then it checks whether the index step's key is a member of the set and returns that value if so. If unknown values mean that it's not decidable whether there is a matching element then the result is an unknown value of the set's element type, so that traversal can continue and presumably eventually return an unknown value of the appropriate leaf type.


Fixes: #38180

@jbardin jbardin marked this pull request as ready for review March 12, 2026 18:04
@jbardin jbardin requested review from a team as code owners March 12, 2026 18:04
@jbardin jbardin merged commit dea9f7e into main Mar 12, 2026
12 of 13 checks passed
@jbardin jbardin deleted the jbardin/update-cty branch March 12, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do Not Propagate sensitive Flag on Properties when Comparing a nonsensitive Object to null

2 participants