install/build errors log

This commit is contained in:
alessio 2016-08-24 16:13:14 +02:00
parent e1ed9877cc
commit 0875e3c5f9
2 changed files with 9 additions and 9 deletions

View File

@ -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" // GoBuild is an implementation of the "go build"
func (p *Project) GoBuild() error { func (p *Project) GoBuild() (error, string) {
var out bytes.Buffer var out bytes.Buffer
var stderr bytes.Buffer
build := exec.Command("go", "build") build := exec.Command("go", "build")
build.Dir = p.base build.Dir = p.base
build.Stdout = &out build.Stdout = &out
build.Stderr = &stderr
if err := build.Run(); err != nil { if err := build.Run(); err != nil {
return err return err, stderr.String()
} }
return nil return nil, ""
} }
// GoInstall is an implementation of the "go install" // GoInstall is an implementation of the "go install"
@ -97,7 +98,6 @@ func (p *Project) GoInstall() (error, string) {
if err != nil { if err != nil {
return nil, "" return nil, ""
} }
build := exec.Command("go", "install") build := exec.Command("go", "install")
build.Dir = p.base build.Dir = p.base
build.Stdout = &out build.Stdout = &out

View File

@ -130,8 +130,8 @@ func (p *Project) install(channel chan bool, wr *sync.WaitGroup) {
if p.Bin { if p.Bin {
log.Println(pname(p.Name, 1), ":", "Installing..") log.Println(pname(p.Name, 1), ":", "Installing..")
start := time.Now() start := time.Now()
if err := p.GoInstall(); err != nil { if err, std := p.GoInstall(); err != nil {
log.Println(pname(p.Name, 1), ":", Red(err.Error())) log.Println(pname(p.Name, 1), ":", fmt.Sprint(Red(err)), std)
wr.Done() wr.Done()
} else { } else {
log.Println(pname(p.Name, 5), ":", Green("Installed")+" after", MagentaS(big.NewFloat(float64(time.Since(start).Seconds())).Text('f', 3), "s")) 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 { if p.Build {
log.Println(pname(p.Name, 1), ":", "Building..") log.Println(pname(p.Name, 1), ":", "Building..")
start := time.Now() start := time.Now()
if err := p.GoBuild(); err != nil { if err, std := p.GoBuild(); err != nil {
log.Println(pname(p.Name, 1), ":", Red(err.Error())) log.Println(pname(p.Name, 1), ":", fmt.Sprint(Red(err)), std)
} else { } else {
log.Println(pname(p.Name, 5), ":", Green("Builded")+" after", MagentaS(big.NewFloat(float64(time.Since(start).Seconds())).Text('f', 3), "s")) log.Println(pname(p.Name, 5), ":", Green("Builded")+" after", MagentaS(big.NewFloat(float64(time.Since(start).Seconds())).Text('f', 3), "s"))
} }