deps: Update github.com/hashicorp/hil/...

This commit is contained in:
James Nugent 2016-04-18 17:15:50 -07:00
parent 6360e6c8b6
commit 14cf31cf43
2 changed files with 19 additions and 19 deletions

4
Godeps/Godeps.json generated
View File

@ -782,11 +782,11 @@
},
{
"ImportPath": "github.com/hashicorp/hil",
"Rev": "0640fefa3817883b16b77bf760c4c3a6f2589545"
"Rev": "01dc167cd239b7ccab78a683b866536cd5904719"
},
{
"ImportPath": "github.com/hashicorp/hil/ast",
"Rev": "0640fefa3817883b16b77bf760c4c3a6f2589545"
"Rev": "01dc167cd239b7ccab78a683b866536cd5904719"
},
{
"ImportPath": "github.com/hashicorp/logutils",

View File

@ -16,23 +16,6 @@ func InterfaceToVariable(input interface{}) (ast.Variable, error) {
}, 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{}
if err := mapstructure.WeakDecode(input, &mapVal); err == nil {
elements := make(map[string]ast.Variable)
@ -50,5 +33,22 @@ func InterfaceToVariable(input interface{}) (ast.Variable, error) {
}, 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)
}