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

Allow using dig.As with dig.Group #375

Merged
merged 4 commits into from
Jan 30, 2023
Merged

Allow using dig.As with dig.Group #375

merged 4 commits into from
Jan 30, 2023

Conversation

tchung1118
Copy link
Contributor

@tchung1118 tchung1118 commented Jan 25, 2023

This PR adds the ability to use dig.As with dig.Group.
When dig.As is used with dig.Group, the value produced
by the constructor will be provided to the specified group
as the type specified by dig.As.

 c.Provide(newBuffer, dig.As(new(io.Reader)), dig.Group("readers"))

For example, the above code is equivalent to the following.

 c.Provide(func(...) io.Reader {
   b := newBuffer(...)
   return b
 }, dig.Group("readers"))

Fixes #341

@codecov
Copy link

codecov bot commented Jan 25, 2023

Codecov Report

Merging #375 (24e9c43) into master (5ae7b1f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 24e9c43 differs from pull request most recent head 5596d66. Consider uploading reports for the commit 5596d66 to get more accurate results

@@            Coverage Diff             @@
##           master     #375      +/-   ##
==========================================
+ Coverage   98.33%   98.35%   +0.01%     
==========================================
  Files          21       21              
  Lines        1441     1458      +17     
==========================================
+ Hits         1417     1434      +17     
  Misses         15       15              
  Partials        9        9              
Impacted Files Coverage Δ
provide.go 100.00% <100.00%> (ø)
result.go 99.01% <100.00%> (+0.09%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@tchung1118 tchung1118 marked this pull request as ready for review January 25, 2023 18:27
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.

On behalf of @r-hang

@sywhang
Copy link
Contributor

sywhang commented Jan 30, 2023

looks like our GH account has some billing issues, OSPO is already working on fixing that.

@tchung1118 tchung1118 merged commit c8f963c into master Jan 30, 2023
@tchung1118 tchung1118 deleted the 341 branch January 30, 2023 19:00
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.

Allow dig.As with dig.Group
4 participants