wire: update Provider.Out to be a slice of provided types, and keep track of the provided concrete type in ProviderSet.providerMap (google/go-cloud#332)
Update Provider.Out to be a slice of provided types, and keep track of the provided concrete type in ProviderSet.providerMap, to more clearly model-named struct providers (which provide both the struct type and a pointer to the struct type). Fixes google/go-cloud#325.
This commit is contained in:
committed by
Ross Light
parent
86725a2b3f
commit
e93f33129e
@@ -22,7 +22,8 @@ import (
|
||||
|
||||
func main() {
|
||||
fb := injectFooBar()
|
||||
fmt.Println(fb.Foo, fb.Bar)
|
||||
e := injectEmptyStruct()
|
||||
fmt.Printf("%d %d %v\n", fb.Foo, fb.Bar, e)
|
||||
}
|
||||
|
||||
type Foo int
|
||||
@@ -33,6 +34,8 @@ type FooBar struct {
|
||||
Bar Bar
|
||||
}
|
||||
|
||||
type Empty struct{}
|
||||
|
||||
func provideFoo() Foo {
|
||||
return 41
|
||||
}
|
||||
|
||||
@@ -24,3 +24,8 @@ func injectFooBar() *FooBar {
|
||||
wire.Build(Set)
|
||||
return nil
|
||||
}
|
||||
|
||||
func injectEmptyStruct() *Empty {
|
||||
wire.Build(Empty{})
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
41 1
|
||||
41 1 &{}
|
||||
|
||||
@@ -16,3 +16,8 @@ func injectFooBar() *FooBar {
|
||||
}
|
||||
return fooBar
|
||||
}
|
||||
|
||||
func injectEmptyStruct() *Empty {
|
||||
empty := &Empty{}
|
||||
return empty
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user