wire: FieldsOf now provides a pointer to the field type as well as the actual field type (#209)
This commit is contained in:
@@ -26,4 +26,5 @@ func provideS() S {
|
||||
|
||||
func main() {
|
||||
fmt.Println(injectedMessage())
|
||||
fmt.Println("pointer to " + *injectedMessagePtr())
|
||||
}
|
||||
|
||||
@@ -26,3 +26,10 @@ func injectedMessage() string {
|
||||
wire.FieldsOf(new(S), "Foo"))
|
||||
return ""
|
||||
}
|
||||
|
||||
func injectedMessagePtr() *string {
|
||||
wire.Build(
|
||||
provideS,
|
||||
wire.FieldsOf(new(S), "Foo"))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Hello, World!
|
||||
pointer to Hello, World!
|
||||
|
||||
@@ -12,3 +12,9 @@ func injectedMessage() string {
|
||||
string2 := s.Foo
|
||||
return string2
|
||||
}
|
||||
|
||||
func injectedMessagePtr() *string {
|
||||
s := provideS()
|
||||
string2 := &s.Foo
|
||||
return string2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user