wire: give wire.Bind access to the arguments to the injector function (google/go-cloud#715)
This commit is contained in:
committed by
Ross Light
parent
67170e739d
commit
6ea381b3fe
1
internal/wire/testdata/BindInjectorArg/want/program_out.txt
vendored
Normal file
1
internal/wire/testdata/BindInjectorArg/want/program_out.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
hello
|
||||
@@ -1 +0,0 @@
|
||||
example.com/foo/wire.go:x:y: no binding for *example.com/foo.Foo
|
||||
13
internal/wire/testdata/BindInjectorArg/want/wire_gen.go
vendored
Normal file
13
internal/wire/testdata/BindInjectorArg/want/wire_gen.go
vendored
Normal 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
|
||||
}
|
||||
@@ -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)
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
func injectFoo() Foo {
|
||||
// This non-call statement makes this an invalid injector.
|
||||
_ = 42
|
||||
_ = 42
|
||||
panic(wire.Build(provideFoo))
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -17,5 +17,3 @@ package bar
|
||||
var foo struct {
|
||||
X int
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user