veyron/{services/mgmt,tools}/build: fixing the build server shell test

Change-Id: Icfbab43b9e6893588d91bad117c862cc8e549353
diff --git a/services/mgmt/build/buildd/test.sh b/services/mgmt/build/buildd/test.sh
index ec0a441..9b587c7 100755
--- a/services/mgmt/build/buildd/test.sh
+++ b/services/mgmt/build/buildd/test.sh
@@ -6,6 +6,7 @@
 # verify that <build>.Build() works as expected.
 
 source "${VEYRON_ROOT}/environment/scripts/lib/shell_test.sh"
+source "${VEYRON_ROOT}/environment/scripts/lib/go.sh"
 
 build() {
   local -r GO="${REPO_ROOT}/scripts/build/go"
@@ -21,7 +22,14 @@
 
   # Start the binary repository daemon.
   local -r SERVER="buildd-test-server"
-  shell_test::start_server ./buildd --name="${SERVER}" --gobin="${VEYRON_ROOT}/environment/go/bin/go" --address=127.0.0.1:0
+  local GO_BIN=$(which go)
+  if [[ -n "${GO_BIN}" ]] && go::usable_release "${GO_BIN}"; then
+    local -r GO_ROOT=$(go env GOROOT)
+  else
+    local -r GO_ROOT="${VEYRON_ROOT}/environment/go/$(go::os)/$(go::architecture)"
+    GO_BIN="${GO_ROOT}/bin/go"
+  fi
+  shell_test::start_server ./buildd --name="${SERVER}" --gobin="${GO_BIN}" --goroot="${GO_ROOT}" --address=127.0.0.1:0
 
   # Create and build a test source file.
   local -r ROOT=$(shell::tmp_dir)
diff --git a/tools/build/impl/impl.go b/tools/build/impl/impl.go
index f575475..eb76237 100644
--- a/tools/build/impl/impl.go
+++ b/tools/build/impl/impl.go
@@ -178,7 +178,7 @@
 			return
 		}
 		if out, err := stream.Finish(); err != nil {
-			errchan <- fmt.Errorf("Finish() failed: (%v, %v)", out, err)
+			errchan <- fmt.Errorf("Finish() failed: (%v, %v)", string(out), err)
 			return
 		}
 		errchan <- nil