-
Notifications
You must be signed in to change notification settings - Fork 290
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
doc: Add FAQ page #1160
doc: Add FAQ page #1160
Conversation
Adds an FAQ page to the Fx documentation, aiming to address frequently asked questions. This includes two entries that came up at work recently. Includes a test for the `fx.Supply` entry because I couldn't find the test for it right away. (I found it in annotated_test.go later but you won't hear me complain about additional tests.)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1160 +/- ##
=======================================
Coverage 98.78% 98.78%
=======================================
Files 30 30
Lines 3057 3057
=======================================
Hits 3020 3020
Misses 30 30
Partials 7 7 ☔ View full report in Codecov by Sentry. |
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.
Awesome, thanks! One small comment.
## Does the order of `fx.Option`s matter? | ||
|
||
No, the order in which you provide various Fx options | ||
to `fx.Options`, `fx.New`, `fx.Module`, and others does not matter. |
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.
I don't think this is true for determining the order in which fx.Invoke
d functions get run, which was a recent point of confusion (ref: #1152). Consider exempting Invoke from this statement.
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.
Fair. There's a weird situation here.
On paper, there's no guarantee about the order in which invokes run.
But you're right, their order matters.
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.
@JacobOaks I realized that this was actually too simplified and lost some information.
Ordering of options relative to fx.New is irrelevant, but ordering of operations relative to each other can matter.
I've rewritten this section to better clarify this.
LMK what you think
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.
Actually, looks like we do document the fx.Invoke invocation order.
I'll update this entry.
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!
Adds an FAQ page to the Fx documentation,
aiming to address frequently asked questions.
This includes two entries that came up at work recently.
Includes a test for the
fx.Supply
entrybecause I couldn't find the test for it right away.
(I found it in annotated_test.go later but you won't hear me complain
about additional tests.)