From 80f5b5251295dc5578a0015ff1270d8f0d767d13 Mon Sep 17 00:00:00 2001 From: gedi Date: Mon, 8 Oct 2018 16:29:24 +0300 Subject: [PATCH] backward compatibility with go1.5 --- builder.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/builder.go b/builder.go index 4cd745d..4281f50 100644 --- a/builder.go +++ b/builder.go @@ -90,10 +90,13 @@ func Build(bin string) error { // since we do not need it for godog suite. // we also print back the temp WORK directory // go has built. We will reuse it for our suite workdir. - out, err = exec.Command("go", "test", "-c", "-work", "-o", os.DevNull).CombinedOutput() + // go1.5 does not support os.DevNull as void output + temp := fmt.Sprintf(filepath.Join("%s", "temp-%d.test"), os.TempDir(), time.Now().UnixNano()) + out, err = exec.Command("go", "test", "-c", "-work", "-o", temp).CombinedOutput() if err != nil { return fmt.Errorf("failed to compile tested package: %s, reason: %v, output: %s", pkg.Name, err, string(out)) } + defer os.Remove(temp) // extract go-build temporary directory as our workdir lines := strings.Split(strings.TrimSpace(string(out)), "\n")