goose: require pointer for first argument to goose.Bind (google/go-cloud#31)

Fixes google/go-cloud#15
This commit is contained in:
Ross Light
2018-05-29 08:45:14 -07:00
parent 7a864edab7
commit e9a61ba66b
6 changed files with 22 additions and 17 deletions

View File

@@ -43,11 +43,12 @@ func Build(...interface{}) string {
type Binding struct{}
// Bind declares that a concrete type should be used to satisfy a
// dependency on iface.
// dependency on the type of iface, which must be a pointer to an
// interface type.
//
// Example:
//
// var MySet = goose.NewSet(goose.Bind(MyInterface(nil), new(MyStruct)))
// var MySet = goose.NewSet(goose.Bind(new(MyInterface), new(MyStruct)))
func Bind(iface, to interface{}) Binding {
return Binding{}
}