mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
vendor: github.com/zclconf/go-cty v1.16.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
26026810fe
commit
66ecb53fa7
2
go.mod
2
go.mod
@ -44,7 +44,7 @@ require (
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tonistiigi/fsutil v0.0.0-20241121093142-31cf1f437184
|
||||
github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4
|
||||
github.com/zclconf/go-cty v1.14.4
|
||||
github.com/zclconf/go-cty v1.16.0
|
||||
go.opentelemetry.io/otel v1.28.0
|
||||
go.opentelemetry.io/otel/metric v1.28.0
|
||||
go.opentelemetry.io/otel/sdk v1.28.0
|
||||
|
4
go.sum
4
go.sum
@ -462,8 +462,8 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/zclconf/go-cty v1.4.0/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ=
|
||||
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
|
||||
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
github.com/zclconf/go-cty v1.16.0 h1:xPKEhst+BW5D0wxebMZkxgapvOE/dw7bFTlgSc9nD6w=
|
||||
github.com/zclconf/go-cty v1.16.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
|
||||
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
|
8
vendor/github.com/zclconf/go-cty/cty/convert/conversion.go
generated
vendored
8
vendor/github.com/zclconf/go-cty/cty/convert/conversion.go
generated
vendored
@ -171,12 +171,16 @@ func getConversionKnown(in cty.Type, out cty.Type, unsafe bool) conversion {
|
||||
}
|
||||
if out.IsCapsuleType() {
|
||||
if fn := out.CapsuleOps().ConversionTo; fn != nil {
|
||||
return conversionToCapsule(in, out, fn)
|
||||
if conv := conversionToCapsule(in, out, fn); conv != nil {
|
||||
return conv
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.IsCapsuleType() {
|
||||
if fn := in.CapsuleOps().ConversionFrom; fn != nil {
|
||||
return conversionFromCapsule(in, out, fn)
|
||||
if conv := conversionFromCapsule(in, out, fn); conv != nil {
|
||||
return conv
|
||||
}
|
||||
}
|
||||
}
|
||||
// No conversion operation is available, then.
|
||||
|
2
vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go
generated
vendored
2
vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go
generated
vendored
@ -162,7 +162,7 @@ func conversionCollectionToMap(ety cty.Type, conv conversion) conversion {
|
||||
if ety == cty.DynamicPseudoType {
|
||||
return cty.MapValEmpty(val.Type().ElementType()), nil
|
||||
}
|
||||
return cty.MapValEmpty(ety), nil
|
||||
return cty.MapValEmpty(ety.WithoutOptionalAttributesDeep()), nil
|
||||
}
|
||||
|
||||
if ety.IsCollectionType() || ety.IsObjectType() {
|
||||
|
33
vendor/github.com/zclconf/go-cty/cty/function/function.go
generated
vendored
33
vendor/github.com/zclconf/go-cty/cty/function/function.go
generated
vendored
@ -251,15 +251,25 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) {
|
||||
if err != nil {
|
||||
return cty.NilVal, err
|
||||
}
|
||||
|
||||
var resultMarks []cty.ValueMarks
|
||||
// If we are returning an unknown early due to some unknown in the
|
||||
// arguments, we first need to complete the iteration over all the args
|
||||
// to ensure we collect as many marks as possible for resultMarks.
|
||||
returnUnknown := false
|
||||
|
||||
if dynTypeArgs {
|
||||
// returnTypeForValues sets this if any argument was inexactly typed
|
||||
// and the corresponding parameter did not indicate it could deal with
|
||||
// that. In that case we also avoid calling the implementation function
|
||||
// because it will also typically not be ready to deal with that case.
|
||||
return cty.UnknownVal(expectedType), nil
|
||||
returnUnknown = true
|
||||
}
|
||||
|
||||
if refineResult := f.spec.RefineResult; refineResult != nil {
|
||||
// If returnUnknown is set already, it means we don't have a refinement
|
||||
// because of dynTypeArgs, but we may still need to collect marks from the
|
||||
// rest of the arguments.
|
||||
if refineResult := f.spec.RefineResult; refineResult != nil && !returnUnknown {
|
||||
// If this function has a refinement callback then we'll refine
|
||||
// our result value in the same way regardless of how we return.
|
||||
// It's the function author's responsibility to ensure that the
|
||||
@ -280,15 +290,10 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) {
|
||||
// values and marked values.
|
||||
posArgs := args[:len(f.spec.Params)]
|
||||
varArgs := args[len(f.spec.Params):]
|
||||
var resultMarks []cty.ValueMarks
|
||||
|
||||
for i, spec := range f.spec.Params {
|
||||
val := posArgs[i]
|
||||
|
||||
if !val.IsKnown() && !spec.AllowUnknown {
|
||||
return cty.UnknownVal(expectedType), nil
|
||||
}
|
||||
|
||||
if !spec.AllowMarked {
|
||||
unwrappedVal, marks := val.UnmarkDeep()
|
||||
if len(marks) > 0 {
|
||||
@ -305,14 +310,15 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) {
|
||||
args = newArgs
|
||||
}
|
||||
}
|
||||
|
||||
if !val.IsKnown() && !spec.AllowUnknown {
|
||||
returnUnknown = true
|
||||
}
|
||||
}
|
||||
|
||||
if f.spec.VarParam != nil {
|
||||
spec := f.spec.VarParam
|
||||
for i, val := range varArgs {
|
||||
if !val.IsKnown() && !spec.AllowUnknown {
|
||||
return cty.UnknownVal(expectedType), nil
|
||||
}
|
||||
if !spec.AllowMarked {
|
||||
unwrappedVal, marks := val.UnmarkDeep()
|
||||
if len(marks) > 0 {
|
||||
@ -323,8 +329,15 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) {
|
||||
args = newArgs
|
||||
}
|
||||
}
|
||||
if !val.IsKnown() && !spec.AllowUnknown {
|
||||
returnUnknown = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if returnUnknown {
|
||||
return cty.UnknownVal(expectedType).WithMarks(resultMarks...), nil
|
||||
}
|
||||
|
||||
var retVal cty.Value
|
||||
{
|
||||
|
13
vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go
generated
vendored
13
vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go
generated
vendored
@ -147,12 +147,6 @@ var ElementFunc = function.New(&function.Spec{
|
||||
},
|
||||
Type: func(args []cty.Value) (cty.Type, error) {
|
||||
list := args[0]
|
||||
index := args[1]
|
||||
if index.IsKnown() {
|
||||
if index.LessThan(cty.NumberIntVal(0)).True() {
|
||||
return cty.DynamicPseudoType, fmt.Errorf("cannot use element function with a negative index")
|
||||
}
|
||||
}
|
||||
|
||||
listTy := list.Type()
|
||||
switch {
|
||||
@ -189,10 +183,6 @@ var ElementFunc = function.New(&function.Spec{
|
||||
return cty.DynamicVal, fmt.Errorf("invalid index: %s", err)
|
||||
}
|
||||
|
||||
if args[1].LessThan(cty.NumberIntVal(0)).True() {
|
||||
return cty.DynamicVal, fmt.Errorf("cannot use element function with a negative index")
|
||||
}
|
||||
|
||||
input, marks := args[0].Unmark()
|
||||
if !input.IsKnown() {
|
||||
return cty.UnknownVal(retType), nil
|
||||
@ -203,6 +193,9 @@ var ElementFunc = function.New(&function.Spec{
|
||||
return cty.DynamicVal, errors.New("cannot use element function with an empty list")
|
||||
}
|
||||
index = index % l
|
||||
if index < 0 {
|
||||
index += l
|
||||
}
|
||||
|
||||
// We did all the necessary type checks in the type function above,
|
||||
// so this is guaranteed not to fail.
|
||||
|
2
vendor/github.com/zclconf/go-cty/cty/walk.go
generated
vendored
2
vendor/github.com/zclconf/go-cty/cty/walk.go
generated
vendored
@ -213,7 +213,7 @@ func transform(path Path, val Value, t Transformer) (Value, error) {
|
||||
atys := ty.AttributeTypes()
|
||||
newAVs := make(map[string]Value)
|
||||
for name := range atys {
|
||||
av := val.GetAttr(name)
|
||||
av := rawVal.GetAttr(name)
|
||||
path := append(path, GetAttrStep{
|
||||
Name: name,
|
||||
})
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -738,7 +738,7 @@ github.com/xeipuuv/gojsonreference
|
||||
# github.com/xeipuuv/gojsonschema v1.2.0
|
||||
## explicit
|
||||
github.com/xeipuuv/gojsonschema
|
||||
# github.com/zclconf/go-cty v1.14.4
|
||||
# github.com/zclconf/go-cty v1.16.0
|
||||
## explicit; go 1.18
|
||||
github.com/zclconf/go-cty/cty
|
||||
github.com/zclconf/go-cty/cty/convert
|
||||
|
Loading…
x
Reference in New Issue
Block a user