-
Couldn't load subscription status.
- Fork 5
go: add messager container provider #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
cd647b2 to
c62681c
Compare
e9139c1 to
d173be5
Compare
3792631 to
0b02b55
Compare
| fmt.Printf("PatchReplaceConf: %v\n", hub.GetHub().GetPatchReplaceConf().Data()) | ||
| // print provided patch replace conf | ||
| fmt.Printf("PatchReplaceConf(provided): %v\n", hub.GetHub().ProvidedBy(ctx).GetPatchReplaceConf().Data()) | ||
| // print patch replace conf binding to background context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please obey the context API convention amd design elegant APIs:
ctx := hub.GetHub().BindTo(ctx)->ctx = hub.NewContext(ctx, myhub)myhub := hub.GetHub().ProvidedBy(ctx)->myhub = hub.FromContext(ctx)
Refer to https://pkg.go.dev/context#Context

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not bind a hub to context, but bind its messager container. ctx = hub.NewContext(ctx, myhub) will lead to misunderstanding.
| @@ -0,0 +1,208 @@ | |||
| import ( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to add another abstraction: base hub.
"Keep it simple, stupid!"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
No description provided.