Skip to content
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

Move advanced features to package documentation #1163

Merged
merged 4 commits into from
Feb 20, 2024

Conversation

abhinav
Copy link
Collaborator

@abhinav abhinav commented Feb 17, 2024

The documentation for parameter structs, result structs,
named values, optional values, value groups, etc.
is currently scattered between In and Out.

First, on the logistics end:
this has made it impossible to link to some of these docs because they
share the same hadings:
https://pkg.go.dev/go.uber.org/fx#hdr-Named_Values goes to the named
values section of fx.In. It's not possible to link to the named values
section of the fx.Out struct (which is also called Named Values).

More importantly, from the doc readability point of view, jumping
between In and Out is annoying and doesn't make for good reading.

This PR moves these to the package-level docs and improves the flow of
how this information is presented:

First, we introduce parameter and result structs.
Then we weave through the two introducing various topics:

Producing named values        Result structs
Consuming named values        Parameter structs
Optional dependencies         Parameter structs
Producing value groups        Result structs
Consuming value groups        Parameter structs
Soft value groups             Parameter structs
Value group flattening        Result structs
Unexported fields             Parameter structs

This makes the story of these topics a bit easier to follow.

In the future, we can introduce annotation right
after parameter and result structs,
or between value groups and soft value groups.

Note that this does not touch on the core operations
(provide, invoke, decorate).
It's just moving existing documentation around.

The documentation for parameter structs, result structs,
named values, optional values, value groups, etc.
is currently scattered between In and Out.

First, on the logistics end:
this has made it impossible to link to some of these docs because they
share the same hadings:
https://pkg.go.dev/go.uber.org/fx#hdr-Named_Values goes to the named
values section of fx.In. It's not possible to link to the named values
section of the fx.Out struct (which is also called Named Values).

More importantly, from the doc readability point of view, jumping
between In and Out is annoying and doesn't make for good reading.

This PR moves these to the package-level docs and improves the flow of
how this information is presented:

First, we introduce parameter and result structs.
Then we weave through the two introducing various topics:

    Producing named values        Result structs
    Consuming named values        Parameter structs
    Optional dependencies         Parameter structs
    Producing value groups        Result structs
    Consuming value groups        Parameter structs
    Soft value groups             Parameter structs
    Value group flattening        Result structs
    Unexported fields             Parameter structs

This makes the story of these topics a bit easier to follow.

In the future, we can introduce annotation right
after parameter and result structs,
or between value groups and soft value groups.

Note that this does not touch on the core operations
(provide, invoke, decorate).
It's just moving existing documentation around.
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d00172a) 98.79% compared to head (5d54532) 98.79%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1163   +/-   ##
=======================================
  Coverage   98.79%   98.79%           
=======================================
  Files          30       30           
  Lines        3061     3061           
=======================================
  Hits         3024     3024           
  Misses         30       30           
  Partials        7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@JacobOaks JacobOaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

doc.go Outdated Show resolved Hide resolved
doc.go Outdated Show resolved Hide resolved
@abhinav abhinav merged commit c013ff6 into uber-go:master Feb 20, 2024
12 checks passed
@abhinav abhinav deleted the abg/pkg-doc branch February 20, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants