From 5c87009ca432b4992e02ac8608cf9ab53f2a0771 Mon Sep 17 00:00:00 2001 From: Lev <1187448+levb@users.noreply.github.com> Date: Tue, 23 Jul 2019 21:22:15 -0700 Subject: [PATCH] no ticket: Show go compile output for embedded unit test plugins (#11689) Hmm, by the time I looked again the test is passing. --- utils/test_files_compiler.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/test_files_compiler.go b/utils/test_files_compiler.go index d8a5fad87f..3ff81c2674 100644 --- a/utils/test_files_compiler.go +++ b/utils/test_files_compiler.go @@ -4,6 +4,7 @@ package utils import ( + "bytes" "fmt" "io/ioutil" "os" @@ -50,10 +51,14 @@ func CompileGo(t *testing.T, sourceCode, outputPath string) { goMod(t, dir, "edit", "-replace", fmt.Sprintf("github.com/mattermost/mattermost-server@v0.0.0=%s", mattermostServerPath)) } + out := &bytes.Buffer{} cmd := exec.Command("go", "build", "-o", outputPath, "main.go") cmd.Dir = dir - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr + cmd.Stdout = out + cmd.Stderr = out err = cmd.Run() + if err != nil { + t.Log("Go compile errors:\n", out.String()) + } require.NoError(t, err, "failed to compile go") }