wire: fix error messages for Bind and InterfaceValue when the arg doesn't implement the interface (google/go-cloud#491)
Fixes google/go-cloud#490
This commit is contained in:
committed by
Ross Light
parent
2c50843322
commit
be8ecba636
17
README.md
17
README.md
@@ -237,6 +237,23 @@ interface type and the second argument is a zero value of the concrete type. Any
|
||||
set that includes an interface binding must also have a provider in the same set
|
||||
that provides the concrete type.
|
||||
|
||||
If necessary, you can also bind one interface to another:
|
||||
|
||||
```go
|
||||
type FooerPlus interface {
|
||||
Fooer
|
||||
Bar() String
|
||||
}
|
||||
|
||||
func ProviderFooerPlus() FooerPlus {
|
||||
...
|
||||
}
|
||||
|
||||
var FooerPlusAsFooer = wire.NewSet(
|
||||
ProvideFooerPlus,
|
||||
wire.Bind(new(Fooer), *new(FooerPlus)))
|
||||
```
|
||||
|
||||
[type identity]: https://golang.org/ref/spec#Type_identity
|
||||
[return concrete types]: https://github.com/golang/go/wiki/CodeReviewComments#interfaces
|
||||
|
||||
|
||||
Reference in New Issue
Block a user