Skip to content

Commit

Permalink
wire: make Vendor test work with Go module (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
shantuo authored and vangent committed Sep 21, 2018
1 parent 8c13065 commit d51dabf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
16 changes: 0 additions & 16 deletions wire/internal/wire/testdata/Vendor/bar/dummy.go

This file was deleted.

10 changes: 5 additions & 5 deletions wire/internal/wire/wire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ func TestWire(t *testing.T) {
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
if test.name == "Vendor" && os.Getenv("GO111MODULE") != "off" {
// TODO: Remove the GO111MODULE check when it is not relevant (maybe after Go 1.12).
t.Skip("Skipped testing for vendored package for Go module turned on, see https://github.com/google/go-cloud/issues/326")
}
t.Parallel()

// Run Wire from a fake build context.
Expand Down Expand Up @@ -167,7 +163,11 @@ func goBuildCheck(test *testCase, wd string, bctx *build.Context, gen []byte) er
ReleaseTags: bctx.ReleaseTags,
}
buildDir := filepath.Join(gopath, "src", genPkg.ImportPath)
if err := runGo(realBuildCtx, buildDir, "build", "-o", testExePath); err != nil {
buildCmd := []string{"build", "-o", testExePath}
if test.name == "Vendor" && os.Getenv("GO111MODULE") == "on" {
buildCmd = append(buildCmd, "-mod=vendor")
}
if err := runGo(realBuildCtx, buildDir, buildCmd...); err != nil {
return fmt.Errorf("build: %v", err)
}

Expand Down

0 comments on commit d51dabf

Please sign in to comment.