Logo
Explore Help
Register Sign In
admin/wire
1
0
Fork 0
You've already forked wire
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
Files
f8e446fa171d18bfd430d7d292d096eeb63cb451
wire/internal/goose/testdata/StructPointer/foo/foo.go

34 lines
325 B
Go
Raw Normal View History

goose: add struct field injection This makes options structs and application structs much simpler to inject. Reviewed-by: Tuo Shan <shantuo@google.com>
2018-04-03 21:11:53 -07:00
package main
goose: use marker functions instead of comments To avoid making this CL too large, I did not migrate the existing goose comments through the repository. This will be addressed in a subsequent CL. Reviewed-by: Tuo Shan <shantuo@google.com>
2018-04-27 13:44:54 -04:00
import (
"fmt"
"codename/goose"
)
goose: add struct field injection This makes options structs and application structs much simpler to inject. Reviewed-by: Tuo Shan <shantuo@google.com>
2018-04-03 21:11:53 -07:00
func main() {
fb := injectFooBar()
fmt.Println(fb.Foo, fb.Bar)
}
type Foo int
type Bar int
type FooBar struct {
Foo Foo
Bar Bar
}
func provideFoo() Foo {
return 41
}
func provideBar() Bar {
return 1
}
goose: use marker functions instead of comments To avoid making this CL too large, I did not migrate the existing goose comments through the repository. This will be addressed in a subsequent CL. Reviewed-by: Tuo Shan <shantuo@google.com>
2018-04-27 13:44:54 -04:00
var Set = goose.NewSet(
FooBar{},
provideFoo,
provideBar)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.3 Page: 75ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API