From 46ced86a1ce233195b5919cfbf6fc3606301a6d8 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Thu, 3 Nov 2022 11:34:03 -0700 Subject: [PATCH] Make OutputState pass the `-race` detector --- sdk/go/pulumi/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/go/pulumi/types.go b/sdk/go/pulumi/types.go index 4c4b7533a88e..913c164daabd 100644 --- a/sdk/go/pulumi/types.go +++ b/sdk/go/pulumi/types.go @@ -129,10 +129,14 @@ func (o *OutputState) elementType() reflect.Type { return o.element } +// Fetch the dependencies of an OutputState. It is not thread-safe to mutate values inside +// returned slice. func (o *OutputState) dependencies() []Resource { if o == nil { return nil } + o.cond.L.Lock() + defer o.cond.L.Unlock() return o.deps }