Commit c8f963c
authored
Allow using dig.As with dig.Group (#375)
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 #3411 parent 5ae7b1f commit c8f963c
File tree
5 files changed
+251
-49
lines changed5 files changed
+251
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
| |||
124 | 145 | | |
125 | 146 | | |
126 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
127 | 178 | | |
128 | 179 | | |
129 | 180 | | |
| |||
0 commit comments