wire: fix example in the ProvideBaz section (google/go-cloud#229)

This commit is contained in:
Zachary Romero
2018-07-25 19:31:52 +03:00
committed by Ross Light
parent 1de1d101c7
commit 0a45f324c7

View File

@@ -77,8 +77,8 @@ type Baz struct {
// ProvideBaz returns a value if Bar is not zero.
func ProvideBaz(ctx context.Context, bar Bar) (Baz, error) {
if bar == 0 {
return 0, errors.New("cannot provide baz when bar is zero")
if bar.X == 0 {
return Baz{}, errors.New("cannot provide baz when bar is zero")
}
return Baz{X: bar.X}, nil
}