wire: make Vendor test work with Go module (google/go-cloud#469)
This commit is contained in:
16
internal/wire/testdata/Vendor/bar/dummy.go
vendored
16
internal/wire/testdata/Vendor/bar/dummy.go
vendored
@@ -1,16 +0,0 @@
|
||||
// Copyright 2018 The Go Cloud Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package bar is left intentionally blank.
|
||||
package bar
|
||||
@@ -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.
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user