Fix infinite recursion bug for Go SDK (#4516)
gatherDependencySet was not checking for Resources in the dependency set, which could lead to infinite recursion.
This commit is contained in:
parent
7b17463031
commit
d1ba572e1d
|
@ -3,6 +3,9 @@ CHANGELOG
|
|||
|
||||
## HEAD (unreleased)
|
||||
|
||||
- Fix infinite recursion bug for Go SDK
|
||||
[#4516](https://github.com/pulumi/pulumi/pull/4516)
|
||||
|
||||
- Order secretOutputNames when used in stack references
|
||||
[#4489](https://github.com/pulumi/pulumi/pull/4489)
|
||||
|
||||
|
|
|
@ -454,6 +454,8 @@ func gatherDependencies(v interface{}) []Resource {
|
|||
return deps
|
||||
}
|
||||
|
||||
var resourceType = reflect.TypeOf((*Resource)(nil)).Elem()
|
||||
|
||||
func gatherDependencySet(v reflect.Value, deps map[Resource]struct{}) {
|
||||
for {
|
||||
// Check for an Output that we can pull dependencies off of.
|
||||
|
@ -464,6 +466,14 @@ func gatherDependencySet(v reflect.Value, deps map[Resource]struct{}) {
|
|||
}
|
||||
return
|
||||
}
|
||||
// Check for an actual Resource.
|
||||
if v.Type().Implements(resourceType) {
|
||||
if v.CanInterface() {
|
||||
resource := v.Convert(resourceType).Interface().(Resource)
|
||||
deps[resource] = struct{}{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
|
|
Loading…
Reference in a new issue