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"
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

View File

@ -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"))
}