-
Notifications
You must be signed in to change notification settings - Fork 289
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
fx.Annotate: Support variadic functions #809
Conversation
Codecov Report
@@ Coverage Diff @@
## master #809 +/- ##
=======================================
Coverage 99.04% 99.05%
=======================================
Files 25 25
Lines 946 950 +4
=======================================
+ Hits 937 941 +4
Misses 7 7
Partials 2 2
Continue to review full report at Codecov.
|
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.
Thanks for this change. Looks good to me
There is something wrong that 'value groups cannot be optional' when use optional tags in ParamTags. Refer: uber-go/dig#120 |
Hey, on a second look, this doesn't match the behavior of dig. If we want to support filling variadic arguments with value groups using this, RE: value groups cannot be optional: |
Oh, I got it, very thanks for you explain. |
annotated.go
Outdated
// }, fx.ParamTags(``, `group:"server"`)) | ||
// | ||
// If we provide the above to the application, | ||
// any constructor in the Fx application can feed it HTTP handlers |
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.
nit: it/its
Idea: Instead of 'feed' how about 'inject' or can inject its HTTP handlers with fx.Annotate, fx.Annotated, or fx.Out.
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.
ack
Co-authored-by: Sung Yoon Whang <sungyoonwhang@gmail.com>
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.
LGTM
Thanks! @xqbumu |
Add support to fx.Annotate for variadic functions.
The last parameter of variadic functions is now treated as a slice.
With this users can feed value groups into variadic functions.
Ref uber-go/dig#120