wire: fix example in the ProvideBaz section (google/go-cloud#229)
This commit is contained in:
committed by
Ross Light
parent
1de1d101c7
commit
0a45f324c7
@@ -77,8 +77,8 @@ type Baz struct {
|
|||||||
|
|
||||||
// ProvideBaz returns a value if Bar is not zero.
|
// ProvideBaz returns a value if Bar is not zero.
|
||||||
func ProvideBaz(ctx context.Context, bar Bar) (Baz, error) {
|
func ProvideBaz(ctx context.Context, bar Bar) (Baz, error) {
|
||||||
if bar == 0 {
|
if bar.X == 0 {
|
||||||
return 0, errors.New("cannot provide baz when bar is zero")
|
return Baz{}, errors.New("cannot provide baz when bar is zero")
|
||||||
}
|
}
|
||||||
return Baz{X: bar.X}, nil
|
return Baz{X: bar.X}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user