Avoid aliasing *Output when possible
This commit is contained in:
parent
48ddf5b3b0
commit
f1aec12df2
2 changed files with 5 additions and 5 deletions
|
@ -157,10 +157,9 @@ func marshalInput(v interface{}) (interface{}, []Resource, error) {
|
||||||
return obj, deps, nil
|
return obj, deps, nil
|
||||||
case reflect.Ptr:
|
case reflect.Ptr:
|
||||||
// See if this is an alias for *Output. If so, convert to an *Output, and recurse.
|
// See if this is an alias for *Output. If so, convert to an *Output, and recurse.
|
||||||
e := rv.Elem()
|
ot := reflect.TypeOf(&Output{})
|
||||||
ot := reflect.TypeOf(Output{})
|
if rv.Type().ConvertibleTo(ot) {
|
||||||
if e.Type().ConvertibleTo(ot) {
|
oo := rv.Convert(ot)
|
||||||
oo := e.Convert(ot)
|
|
||||||
return marshalInput(oo.Interface())
|
return marshalInput(oo.Interface())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ func marshalInput(v interface{}) (interface{}, []Resource, error) {
|
||||||
if rv.IsNil() {
|
if rv.IsNil() {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
return marshalInput(e.Interface())
|
return marshalInput(rv.Elem().Interface())
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return marshalInput(rv.String())
|
return marshalInput(rv.String())
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ func RunErr(body RunFunc) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
contract.Assertf(ctx.stackR != "", "expected root stack resource to have a non-empty URN")
|
||||||
|
|
||||||
// Execute the body.
|
// Execute the body.
|
||||||
var result error
|
var result error
|
||||||
|
|
Loading…
Reference in a new issue