This makes options structs and application structs much simpler to inject. Reviewed-by: Tuo Shan <shantuo@google.com>
24 lines
295 B
Go
24 lines
295 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
fb := injectFooBar()
|
|
fmt.Println(fb.Foo, fb.OptionalBar)
|
|
}
|
|
|
|
type Foo int
|
|
type Bar int
|
|
|
|
//goose:provide Set
|
|
//goose:optional OptionalBar
|
|
type FooBar struct {
|
|
Foo Foo
|
|
OptionalBar Bar
|
|
}
|
|
|
|
//goose:provide Set
|
|
func provideFoo() Foo {
|
|
return 42
|
|
}
|