From 707f33ee6c05e37c69b59621142f8e1632cb1ba3 Mon Sep 17 00:00:00 2001 From: Issac Trotts Date: Fri, 27 Jul 2018 11:04:34 -0700 Subject: [PATCH] all: replace more panic(wire.Build(...)) calls with wire.Build(...); return stuff (google/go-cloud#248) Fixes google/go-cloud#246 --- internal/wire/testdata/MultipleMissingInputs/foo/wire.go | 3 ++- wire.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/wire/testdata/MultipleMissingInputs/foo/wire.go b/internal/wire/testdata/MultipleMissingInputs/foo/wire.go index d304057..92c249d 100644 --- a/internal/wire/testdata/MultipleMissingInputs/foo/wire.go +++ b/internal/wire/testdata/MultipleMissingInputs/foo/wire.go @@ -21,5 +21,6 @@ import ( ) func injectBaz() Baz { - panic(wire.Build(provideBaz)) + wire.Build(provideBaz) + return Baz(0) } diff --git a/wire.go b/wire.go index f1e8e77..6673397 100644 --- a/wire.go +++ b/wire.go @@ -30,7 +30,12 @@ func NewSet(...interface{}) ProviderSet { // providers to use. Its arguments are the same as NewSet. Its return // value is an error message that can be sent to panic. // -// Example: +// Examples: +// +// func injector(ctx context.Context) (*sql.DB, error) { +// wire.Build(otherpkg.FooSet, myProviderFunc) +// return nil, nil +// } // // func injector(ctx context.Context) (*sql.DB, error) { // panic(wire.Build(otherpkg.FooSet, myProviderFunc))