wire: FieldsOf now provides a pointer to the field type as well as the actual field type (#209)

This commit is contained in:
Robert van Gent
2019-09-03 12:57:57 -07:00
committed by GitHub
parent 66f78fc846
commit 2b7d1205a1
9 changed files with 69 additions and 26 deletions

View File

@@ -26,4 +26,5 @@ func provideS() S {
func main() {
fmt.Println(injectedMessage())
fmt.Println("pointer to " + *injectedMessagePtr())
}

View File

@@ -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
}

View File

@@ -1 +1,2 @@
Hello, World!
pointer to Hello, World!

View File

@@ -12,3 +12,9 @@ func injectedMessage() string {
string2 := s.Foo
return string2
}
func injectedMessagePtr() *string {
s := provideS()
string2 := &s.Foo
return string2
}