diff --git a/ginkgo/testrunner/build_args.go b/ginkgo/testrunner/build_args.go new file mode 100644 index 0000000000..3b1a238c2c --- /dev/null +++ b/ginkgo/testrunner/build_args.go @@ -0,0 +1,7 @@ +// +build go1.10 + +package testrunner + +var ( + buildArgs = []string{"test", "-c"} +) diff --git a/ginkgo/testrunner/build_args_old.go b/ginkgo/testrunner/build_args_old.go new file mode 100644 index 0000000000..14d70dbcc5 --- /dev/null +++ b/ginkgo/testrunner/build_args_old.go @@ -0,0 +1,7 @@ +// +build !go1.10 + +package testrunner + +var ( + buildArgs = []string{"test", "-c", "-i"} +) diff --git a/ginkgo/testrunner/test_runner.go b/ginkgo/testrunner/test_runner.go index 97a83145fa..a0113e1367 100644 --- a/ginkgo/testrunner/test_runner.go +++ b/ginkgo/testrunner/test_runner.go @@ -64,7 +64,9 @@ func (t *TestRunner) Compile() error { } func (t *TestRunner) BuildArgs(path string) []string { - args := []string{"test", "-c", "-i", "-o", path, t.Suite.Path} + args := make([]string, len(buildArgs), len(buildArgs)+3) + copy(args, buildArgs) + args = append(args, "-o", path, t.Suite.Path) if t.getCoverMode() != "" { args = append(args, "-cover", fmt.Sprintf("-covermode=%s", t.getCoverMode())) diff --git a/ginkgo/testrunner/test_runner_test.go b/ginkgo/testrunner/test_runner_test.go index b6f5567700..58d1fb094b 100644 --- a/ginkgo/testrunner/test_runner_test.go +++ b/ginkgo/testrunner/test_runner_test.go @@ -36,10 +36,13 @@ var _ = Describe("TestRunner", func() { tr := testrunner.New(testsuite.TestSuite{}, 1, false, 0, opts, []string{}) args := tr.BuildArgs(".") + // Remove the "-i" argument; This is discarded in Golang 1.10+. + if args[2] == "-i" { + args = append(args[0:2], args[4:]...) + } Ω(args).Should(Equal([]string{ "test", "-c", - "-i", "-o", ".", "",