Fooer interface { Foo() string } type MyFooer struct {} func (b MyFooer) Foo() string { return "Hello foo" } func provideMyFooer() MyFooer { return MyFooer{} } type Bar struct { fooer Fooer } // wire.go var Set = wire.NewSet( wire.Struct(new(MyFooer), "*"), wire.Bind(new(Fooer), new(*MyFooer)), wire.Struct(new(Bar), "*")) func NewBar() Bar { wire.Build(Set) return Bar{} } 21 DIの初期化部分 成功事例