wire: give wire.Bind access to the arguments to the injector function (google/go-cloud#715)

This commit is contained in:
Robert van Gent
2018-11-16 10:26:10 -08:00
committed by Ross Light
parent 67170e739d
commit 6ea381b3fe
11 changed files with 173 additions and 89 deletions

View File

@@ -0,0 +1 @@
hello

View File

@@ -1 +0,0 @@
example.com/foo/wire.go:x:y: no binding for *example.com/foo.Foo

View File

@@ -0,0 +1,13 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate wire
//+build !wireinject
package main
// Injectors from wire.go:
func inject(foo *Foo) *Bar {
bar := NewBar(foo)
return bar
}

View File

@@ -1 +1,6 @@
example.com/foo/wire.go:x:y: inject injectBar: input of example.com/foo.Foo conflicts with provider provideFoo at example.com/foo/foo.go:x:y
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo
current:
<- provider "provideFoo" (example.com/foo/foo.go:x:y)
<- provider set "Set" (example.com/foo/foo.go:x:y)
previous:
<- argument foo to injector function injectBar (example.com/foo/wire.go:x:y)

View File

@@ -22,7 +22,7 @@ import (
func injectFoo() Foo {
// This non-call statement makes this an invalid injector.
_ = 42
_ = 42
panic(wire.Build(provideFoo))
}

View File

@@ -1 +1,5 @@
example.com/foo/wire.go:x:y: inject inject: multiple inputs of the same type string
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for string
current:
<- argument b to injector function inject (example.com/foo/wire.go:x:y)
previous:
<- argument a to injector function inject (example.com/foo/wire.go:x:y)

View File

@@ -17,5 +17,3 @@ package bar
var foo struct {
X int
}