Global Variables defined in an activity

var globalVar int32

func (a *activity) ActivityMethod(ctx context.Context) error {
     // do something
     globalVar = some_rando_value
     return nil
}

If there are multiple activities running on same worker, i see that globalVar is shared by all the activites.
Why is it so?

Activities are normal Go code. So the global variables are shared the same way they are shared in any other Go code.

BTW don’t use global variables to implement workflows as well.