deps: Update github.com/hashicorp/hil/...
This commit is contained in:
parent
6360e6c8b6
commit
14cf31cf43
|
@ -782,11 +782,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/hil",
|
"ImportPath": "github.com/hashicorp/hil",
|
||||||
"Rev": "0640fefa3817883b16b77bf760c4c3a6f2589545"
|
"Rev": "01dc167cd239b7ccab78a683b866536cd5904719"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/hil/ast",
|
"ImportPath": "github.com/hashicorp/hil/ast",
|
||||||
"Rev": "0640fefa3817883b16b77bf760c4c3a6f2589545"
|
"Rev": "01dc167cd239b7ccab78a683b866536cd5904719"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/logutils",
|
"ImportPath": "github.com/hashicorp/logutils",
|
||||||
|
|
|
@ -16,23 +16,6 @@ func InterfaceToVariable(input interface{}) (ast.Variable, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var sliceVal []interface{}
|
|
||||||
if err := mapstructure.WeakDecode(input, &sliceVal); err == nil {
|
|
||||||
elements := make([]ast.Variable, len(sliceVal))
|
|
||||||
for i, element := range sliceVal {
|
|
||||||
varElement, err := InterfaceToVariable(element)
|
|
||||||
if err != nil {
|
|
||||||
return ast.Variable{}, err
|
|
||||||
}
|
|
||||||
elements[i] = varElement
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast.Variable{
|
|
||||||
Type: ast.TypeList,
|
|
||||||
Value: elements,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var mapVal map[string]interface{}
|
var mapVal map[string]interface{}
|
||||||
if err := mapstructure.WeakDecode(input, &mapVal); err == nil {
|
if err := mapstructure.WeakDecode(input, &mapVal); err == nil {
|
||||||
elements := make(map[string]ast.Variable)
|
elements := make(map[string]ast.Variable)
|
||||||
|
@ -50,5 +33,22 @@ func InterfaceToVariable(input interface{}) (ast.Variable, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sliceVal []interface{}
|
||||||
|
if err := mapstructure.WeakDecode(input, &sliceVal); err == nil {
|
||||||
|
elements := make([]ast.Variable, len(sliceVal))
|
||||||
|
for i, element := range sliceVal {
|
||||||
|
varElement, err := InterfaceToVariable(element)
|
||||||
|
if err != nil {
|
||||||
|
return ast.Variable{}, err
|
||||||
|
}
|
||||||
|
elements[i] = varElement
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast.Variable{
|
||||||
|
Type: ast.TypeList,
|
||||||
|
Value: elements,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
return ast.Variable{}, fmt.Errorf("value for conversion must be a string, interface{} or map[string]interface: got %T", input)
|
return ast.Variable{}, fmt.Errorf("value for conversion must be a string, interface{} or map[string]interface: got %T", input)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue