@@ -79,7 +79,7 @@ func AsInitiatorView(context view.Context, initiator View) (interface{}, error)
7979
8080// RunViewNow invokes the Call function of the given view.
8181// The view context used to the run view is either ctx or the one extracted from the options (see view.WithContext), if present.
82- func RunViewNow (ctx ParentContext , v View , opts ... view.RunViewOption ) (res interface {}, err error ) {
82+ func RunViewNow (parent ParentContext , v View , opts ... view.RunViewOption ) (res interface {}, err error ) {
8383 options , err := view .CompileRunViewOptions (opts ... )
8484 if err != nil {
8585 return nil , errors .Wrap (err , "failed compiling options" )
@@ -89,34 +89,34 @@ func RunViewNow(ctx ParentContext, v View, opts ...view.RunViewOption) (res inte
8989 initiator = v
9090 }
9191
92- goContext := ctx .Context ()
92+ goContext := parent .Context ()
9393 if options .Ctx != nil {
9494 goContext = options .Ctx
9595 }
9696
9797 logger .DebugfContext (goContext , "Start view %s" , GetName (v ))
98- newCtx , span := ctx .StartSpanFrom (goContext , GetName (v ), tracing .WithAttributes (
98+ newCtx , span := parent .StartSpanFrom (goContext , GetName (v ), tracing .WithAttributes (
9999 tracing .String (ViewLabel , GetIdentifier (v )),
100100 tracing .String (InitiatorViewLabel , GetIdentifier (initiator )),
101101 ), trace .WithSpanKind (trace .SpanKindInternal ))
102102 defer span .End ()
103103
104104 var cc ParentContext
105105 if options .SameContext {
106- cc = WrapContext (ctx , newCtx )
106+ cc = WrapContext (parent , newCtx )
107107 } else {
108108 if options .AsInitiator {
109- cc = NewChildContextFromParentAndInitiator (WrapContext (ctx , newCtx ), initiator )
109+ cc = NewChildContextFromParentAndInitiator (WrapContext (parent , newCtx ), initiator )
110110 // register options.Session under initiator
111- contextSession := ctx .Session ()
111+ contextSession := parent .Session ()
112112 if contextSession == nil {
113113 return nil , errors .Errorf ("cannot convert a non-responder context to an initiator context" )
114114 }
115115 if err := cc .PutSession (initiator , contextSession .Info ().Caller , contextSession ); err != nil {
116116 return nil , errors .Wrapf (err , "failed registering default session as initiated by [%s:%s]" , initiator , contextSession .Info ().Caller )
117117 }
118118 } else {
119- cc = NewChildContext (WrapContext (ctx , newCtx ), options .Session , initiator )
119+ cc = NewChildContext (WrapContext (parent , newCtx ), options .Session , initiator )
120120 }
121121 }
122122
0 commit comments