From 477c2acdf8b03c86927087795ea78743fdbae8a2 Mon Sep 17 00:00:00 2001 From: Samer Masterson Date: Thu, 9 Jul 2015 16:27:05 -0700 Subject: [PATCH] Return error immediately if builder.Build() fails. If the command fails, command.ProcessState will be nil and command.ProcessState.Success() in lib/builder.go:60 will panic with a nil pointer error. --- lib/builder.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/builder.go b/lib/builder.go index 0181812..857a2bd 100644 --- a/lib/builder.go +++ b/lib/builder.go @@ -53,6 +53,9 @@ func (b *builder) Build() error { command.Dir = b.dir output, err := command.CombinedOutput() + if err != nil { + return err + } if command.ProcessState.Success() { b.errors = "" @@ -64,5 +67,5 @@ func (b *builder) Build() error { return fmt.Errorf(b.errors) } - return err + return nil }