-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wire/internal/wire: use on-disk GOPATH in generate tests (google/go-c…
…loud#616) The primary motivation is to permit a move to using go/packages instead of go/loader. go/packages runs exclusively by shelling out to the go tool, which precludes use of the in-memory "magic" GOPATH being used up to this point. This has a secondary effect of removing a lot of code to support "magic" GOPATH from the test infrastructure. This is on the whole good, but necessitated a change in the error scrubbing: since the filenames are no longer fixed, error scrubbing also must remove the leading $GOPATH/src lines. Another related change: since all callers of Generate needed to know the package path in order to write out wire_gen.go (necessitating a find-only import search) and Generate already has this information, Generate now returns this information to the caller. This should further reduce callers' coupling to Wire's load internals. It also eliminates code duplication. This should hopefully shake out any difference in path separators for running on Windows, but I have not tested that yet. Updates google/go-cloud#78 Updates google/go-cloud#323
- Loading branch information
Showing
24 changed files
with
301 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
./example.com/foo | ||
./foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: var example.com/foo.myFakeSet struct{} is not a provider or a provider set | ||
example.com/foo/wire.go:x:y: var example.com/foo.myFakeSet struct{} is not a provider or a provider set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: input of example.com/foo.Foo conflicts with provider provideFoo at /wire_gopath/src/example.com/foo/foo.go:x:y | ||
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 |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InjectorMissingCleanup/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectFoo: provider for example.com/foo.Foo returns cleanup but injection does not return cleanup function | ||
example.com/foo/wire.go:x:y: inject injectFoo: provider for example.com/foo.Foo returns cleanup but injection does not return cleanup function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectFoo: provider for example.com/foo.Foo returns error but injection not allowed to fail | ||
example.com/foo/wire.go:x:y: inject injectFoo: provider for example.com/foo.Foo returns error but injection not allowed to fail |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceBindingDoesntImplement/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: string does not implement example.com/foo.Fooer | ||
example.com/foo/wire.go:x:y: string does not implement example.com/foo.Fooer |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceBindingInvalidArg0/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: first argument to Bind must be a pointer to an interface type; found string | ||
example.com/foo/wire.go:x:y: first argument to Bind must be a pointer to an interface type; found string |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceBindingNotEnoughArgs/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: too few arguments in call to wire.Bind | ||
example.com/foo/wire.go:x:y: too few arguments in call to wire.Bind |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceValueDoesntImplement/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: string does not implement io.Reader | ||
example.com/foo/wire.go:x:y: string does not implement io.Reader |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceValueInvalidArg0/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: first argument to InterfaceValue must be a pointer to an interface type; found string | ||
example.com/foo/wire.go:x:y: first argument to InterfaceValue must be a pointer to an interface type; found string |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/InterfaceValueNotEnoughArgs/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: too few arguments in call to wire.InterfaceValue | ||
example.com/foo/wire.go:x:y: too few arguments in call to wire.InterfaceValue |
48 changes: 24 additions & 24 deletions
48
internal/wire/testdata/MultipleBindings/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
current: | ||
<- provider "provideFooAgain" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFooAgain" (example.com/foo/foo.go:x:y) | ||
previous: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
current: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
previous: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
current: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
previous: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "SuperSet" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (example.com/foo/foo.go:x:y) | ||
<- provider set "SuperSet" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/foo.go:x:y: SetWithDuplicateBindings has multiple bindings for example.com/foo.Foo | ||
example.com/foo/foo.go:x:y: SetWithDuplicateBindings has multiple bindings for example.com/foo.Foo | ||
current: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "SuperSet" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (example.com/foo/foo.go:x:y) | ||
<- provider set "SuperSet" (example.com/foo/foo.go:x:y) | ||
previous: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
<- provider set "Set" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Foo | ||
current: | ||
<- wire.Value (/wire_gopath/src/example.com/foo/wire.go:x:y) | ||
<- wire.Value (example.com/foo/wire.go:x:y) | ||
previous: | ||
<- provider "provideFoo" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideFoo" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Bar | ||
example.com/foo/wire.go:x:y: wire.Build has multiple bindings for example.com/foo.Bar | ||
current: | ||
<- wire.Bind (/wire_gopath/src/example.com/foo/wire.go:x:y) | ||
<- wire.Bind (example.com/foo/wire.go:x:y) | ||
previous: | ||
<- provider "provideBar" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
<- provider "provideBar" (example.com/foo/foo.go:x:y) |
18 changes: 9 additions & 9 deletions
18
internal/wire/testdata/MultipleMissingInputs/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectMissingOutputType: no provider found for example.com/foo.Foo, output of injector | ||
example.com/foo/wire.go:x:y: inject injectMissingOutputType: no provider found for example.com/foo.Foo, output of injector | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectMultipleMissingTypes: no provider found for example.com/foo.Foo | ||
needed by example.com/foo.Baz in provider "provideBaz" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
example.com/foo/wire.go:x:y: inject injectMultipleMissingTypes: no provider found for example.com/foo.Foo | ||
needed by example.com/foo.Baz in provider "provideBaz" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectMultipleMissingTypes: no provider found for example.com/foo.Bar | ||
needed by example.com/foo.Baz in provider "provideBaz" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
example.com/foo/wire.go:x:y: inject injectMultipleMissingTypes: no provider found for example.com/foo.Bar | ||
needed by example.com/foo.Baz in provider "provideBaz" (example.com/foo/foo.go:x:y) | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectMissingRecursiveType: no provider found for example.com/foo.Foo | ||
needed by example.com/foo.Zip in provider "provideZip" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
needed by example.com/foo.Zap in provider "provideZap" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
needed by example.com/foo.Zop in provider "provideZop" (/wire_gopath/src/example.com/foo/foo.go:x:y) | ||
example.com/foo/wire.go:x:y: inject injectMissingRecursiveType: no provider found for example.com/foo.Foo | ||
needed by example.com/foo.Zip in provider "provideZip" (example.com/foo/foo.go:x:y) | ||
needed by example.com/foo.Zap in provider "provideZap" (example.com/foo/foo.go:x:y) | ||
needed by example.com/foo.Zop in provider "provideZop" (example.com/foo/foo.go:x:y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectFooer: no provider found for example.com/foo.Fooer, output of injector | ||
example.com/foo/wire.go:x:y: inject injectFooer: no provider found for example.com/foo.Fooer, output of injector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: foo not exported by package bar | ||
example.com/foo/wire.go:x:y: foo not exported by package bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectedMessage: value string can't be used: uses unexported identifier privateMsg | ||
example.com/foo/wire.go:x:y: inject injectedMessage: value string can't be used: uses unexported identifier privateMsg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: unused provider set "unusedSet" | ||
example.com/foo/wire.go:x:y: inject injectBar: unused provider set "unusedSet" | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: unused provider "provideUnused" | ||
example.com/foo/wire.go:x:y: inject injectBar: unused provider "provideUnused" | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: unused value of type string | ||
example.com/foo/wire.go:x:y: inject injectBar: unused value of type string | ||
|
||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: unused interface binding to type example.com/foo.Fooer | ||
example.com/foo/wire.go:x:y: inject injectBar: unused interface binding to type example.com/foo.Fooer |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/ValueFromFunctionScope/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: inject injectBar: value int can't be used: f is not declared in package scope | ||
example.com/foo/wire.go:x:y: inject injectBar: value int can't be used: f is not declared in package scope |
2 changes: 1 addition & 1 deletion
2
internal/wire/testdata/ValueIsInterfaceValue/want/wire_errs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/wire_gopath/src/example.com/foo/wire.go:x:y: argument to Value may not be an interface value (found io.Reader); use InterfaceValue instead | ||
example.com/foo/wire.go:x:y: argument to Value may not be an interface value (found io.Reader); use InterfaceValue instead |
Oops, something went wrong.