mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
Extend hcl2 support with more functions
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
5
vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go
generated
vendored
5
vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go
generated
vendored
@ -12,6 +12,7 @@ var JSONEncodeFunc = function.New(&function.Spec{
|
||||
Name: "val",
|
||||
Type: cty.DynamicPseudoType,
|
||||
AllowDynamicType: true,
|
||||
AllowNull: true,
|
||||
},
|
||||
},
|
||||
Type: function.StaticReturnType(cty.String),
|
||||
@ -24,6 +25,10 @@ var JSONEncodeFunc = function.New(&function.Spec{
|
||||
return cty.UnknownVal(retType), nil
|
||||
}
|
||||
|
||||
if val.IsNull() {
|
||||
return cty.StringVal("null"), nil
|
||||
}
|
||||
|
||||
buf, err := json.Marshal(val, val.Type())
|
||||
if err != nil {
|
||||
return cty.NilVal, err
|
||||
|
Reference in New Issue
Block a user