From 0875e3c5f96af87472fe3a1b05dc5fa15eae88f9 Mon Sep 17 00:00:00 2001 From: alessio Date: Wed, 24 Aug 2016 16:13:14 +0200 Subject: [PATCH] install/build errors log --- realize/project.go | 10 +++++----- realize/watcher.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/realize/project.go b/realize/project.go index 7923d58..457c0b8 100644 --- a/realize/project.go +++ b/realize/project.go @@ -77,16 +77,17 @@ func (p *Project) GoRun(channel chan bool, runner chan bool, wr *sync.WaitGroup) } // GoBuild is an implementation of the "go build" -func (p *Project) GoBuild() error { +func (p *Project) GoBuild() (error, string) { var out bytes.Buffer - + var stderr bytes.Buffer build := exec.Command("go", "build") build.Dir = p.base build.Stdout = &out + build.Stderr = &stderr if err := build.Run(); err != nil { - return err + return err, stderr.String() } - return nil + return nil, "" } // GoInstall is an implementation of the "go install" @@ -97,7 +98,6 @@ func (p *Project) GoInstall() (error, string) { if err != nil { return nil, "" } - build := exec.Command("go", "install") build.Dir = p.base build.Stdout = &out diff --git a/realize/watcher.go b/realize/watcher.go index c590f1e..ed4d778 100644 --- a/realize/watcher.go +++ b/realize/watcher.go @@ -130,8 +130,8 @@ func (p *Project) install(channel chan bool, wr *sync.WaitGroup) { if p.Bin { log.Println(pname(p.Name, 1), ":", "Installing..") start := time.Now() - if err := p.GoInstall(); err != nil { - log.Println(pname(p.Name, 1), ":", Red(err.Error())) + if err, std := p.GoInstall(); err != nil { + log.Println(pname(p.Name, 1), ":", fmt.Sprint(Red(err)), std) wr.Done() } else { log.Println(pname(p.Name, 5), ":", Green("Installed")+" after", MagentaS(big.NewFloat(float64(time.Since(start).Seconds())).Text('f', 3), "s")) @@ -158,8 +158,8 @@ func (p *Project) build() { if p.Build { log.Println(pname(p.Name, 1), ":", "Building..") start := time.Now() - if err := p.GoBuild(); err != nil { - log.Println(pname(p.Name, 1), ":", Red(err.Error())) + if err, std := p.GoBuild(); err != nil { + log.Println(pname(p.Name, 1), ":", fmt.Sprint(Red(err)), std) } else { log.Println(pname(p.Name, 5), ":", Green("Builded")+" after", MagentaS(big.NewFloat(float64(time.Since(start).Seconds())).Text('f', 3), "s")) }