bump github.com/zclconf/go-cty from 1.7.1 to 1.10.0

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-01-13 14:32:10 +01:00
parent 785c861233
commit b67bdedb23
30 changed files with 13397 additions and 193 deletions

View File

@ -116,9 +116,9 @@ func (val Value) GoString() string {
// Use RawEquals to compare if two values are equal *ignoring* the
// short-circuit rules and the exception for null values.
func (val Value) Equals(other Value) Value {
if val.IsMarked() || other.IsMarked() {
val, valMarks := val.Unmark()
other, otherMarks := other.Unmark()
if val.ContainsMarked() || other.ContainsMarked() {
val, valMarks := val.UnmarkDeep()
other, otherMarks := other.UnmarkDeep()
return val.Equals(other).WithMarks(valMarks, otherMarks)
}
@ -191,7 +191,7 @@ func (val Value) Equals(other Value) Value {
switch {
case ty == Number:
result = val.v.(*big.Float).Cmp(other.v.(*big.Float)) == 0
result = rawNumberEqual(val.v.(*big.Float), other.v.(*big.Float))
case ty == Bool:
result = val.v.(bool) == other.v.(bool)
case ty == String:
@ -492,18 +492,23 @@ func (val Value) RawEquals(other Value) bool {
case ty.IsMapType():
ety := ty.typeImpl.(typeMap).ElementTypeT
if len(val.v.(map[string]interface{})) == len(other.v.(map[string]interface{})) {
for k := range val.v.(map[string]interface{}) {
if _, ok := other.v.(map[string]interface{})[k]; !ok {
if !val.HasSameMarks(other) {
return false
}
valUn, _ := val.Unmark()
otherUn, _ := other.Unmark()
if len(valUn.v.(map[string]interface{})) == len(otherUn.v.(map[string]interface{})) {
for k := range valUn.v.(map[string]interface{}) {
if _, ok := otherUn.v.(map[string]interface{})[k]; !ok {
return false
}
lhs := Value{
ty: ety,
v: val.v.(map[string]interface{})[k],
v: valUn.v.(map[string]interface{})[k],
}
rhs := Value{
ty: ety,
v: other.v.(map[string]interface{})[k],
v: otherUn.v.(map[string]interface{})[k],
}
eq := lhs.RawEquals(rhs)
if !eq {
@ -1278,9 +1283,7 @@ func (val Value) AsBigFloat() *big.Float {
}
// Copy the float so that callers can't mutate our internal state
ret := *(val.v.(*big.Float))
return &ret
return new(big.Float).Copy(val.v.(*big.Float))
}
// AsValueSlice returns a []cty.Value representation of a non-null, non-unknown