diff --git a/builder.go b/builder.go index d46b27a..e5e2be7 100644 --- a/builder.go +++ b/builder.go @@ -56,7 +56,7 @@ func (b *builder) Build() error { output, err := command.CombinedOutput() if err != nil { - return err + return fmt.Errorf("build failed with %v\n%s", err, output) } if !command.ProcessState.Success() { diff --git a/builder_test.go b/builder_test.go index c7e6c5a..4abcfeb 100644 --- a/builder_test.go +++ b/builder_test.go @@ -38,10 +38,15 @@ func TestBuilderFailureBuild(t *testing.T) { t.Fatalf("couldn't get current working directory: %v", err) } + absPathBuild := filepath.Join(wd, dir) + b := NewBuilder(dir, bin, wd, bArgs) err = b.Build() assert.NotNil(t, err, "build error") - assert.Equal(t, err.Error(), "exit status 2") + assert.Equal(t, err.Error(), "build failed with exit status 2\n"+ + "# _"+absPathBuild+"\n"+ + "./main.go:4:6: func main must have no arguments and no return values\n"+ + "./main.go:5:1: missing return at end of function\n") } func TestBuilderDefaultBinName(t *testing.T) {