HTRACE-59. Lock go build dependencies to specific versions (cmccabe)
diff --git a/htrace-core/src/go/BUILDING.txt b/htrace-core/src/go/BUILDING.txt
index d54d410..bb3eb88 100644
--- a/htrace-core/src/go/BUILDING.txt
+++ b/htrace-core/src/go/BUILDING.txt
@@ -20,6 +20,7 @@
 You will need to install:
 * The Go programming language
 * The development package for leveldb (some Linux distros call this "leveldb-devel") containing libleveldb.so
+* Version 0 of the "godep" tool from https://github.com/tools/godep/releases
 
 htraced requires libleveldb.so to be in your shared library path in order to run.
 You can set LD_LIBRARY_PATH to the path for this library, or simply install
diff --git a/htrace-core/src/go/Godeps/Godeps.json b/htrace-core/src/go/Godeps/Godeps.json
new file mode 100644
index 0000000..10c8e5d
--- /dev/null
+++ b/htrace-core/src/go/Godeps/Godeps.json
@@ -0,0 +1,26 @@
+{
+    "ImportPath": "git-wip-us.apache.org/repos/asf/incubator-htrace.git",
+    "GoVersion": "go1.3.1",
+    "Deps": [
+        {
+            "ImportPath": "github.com/alecthomas/kingpin",
+            "Rev": "afafa8aab106d31c9dc8f5e562b3f30f6246c3d4"
+        },
+        {
+            "ImportPath": "github.com/alecthomas/units",
+            "Rev": "6b4e7dc5e3143b85ea77909c72caf89416fc2915"
+        },
+        {
+            "ImportPath": "github.com/gorilla/context",
+            "Rev": "215affda49addc4c8ef7e2534915df2c8c35c6cd"
+        },
+        {
+            "ImportPath": "github.com/gorilla/mux",
+            "Rev": "e444e69cbd2e2e3e0749a2f3c717cec491552bbf"
+        },
+        {
+            "ImportPath": "github.com/jmhodges/levigo",
+            "Rev": "2c43dde93d0e056173706534afd514fcbc1dd578"
+        }
+    ]
+}
diff --git a/htrace-core/src/go/gobuild.sh b/htrace-core/src/go/gobuild.sh
index 9e1efa8..3e3c0e7 100755
--- a/htrace-core/src/go/gobuild.sh
+++ b/htrace-core/src/go/gobuild.sh
@@ -32,7 +32,7 @@
     exit 1
 }
 
-ACTION=get
+ACTION=build
 if [ $# -gt 0 ]; then
     if [ "x${1}" == "xbench" ]; then
         # run benchmarks
@@ -47,6 +47,7 @@
 RELEASE_VERSION=${RELEASE_VERSION:-unknown}
 
 SCRIPT_DIR="$(cd "$( dirname $0 )" && pwd)"
+cd $SCRIPT_DIR || die "failed to cd to $SCRIPT_DIR"
 export GOPATH="$GOPATH:${SCRIPT_DIR}"
 export GOBIN="${SCRIPT_DIR}/bin"
 mkdir -p ${GOBIN} || die "failed to create ${GOBIN}"
@@ -81,7 +82,15 @@
     fi
 fi
 
-if [ "$ACTION" == "get" ]; then
+if [ "$ACTION" == "build" ]; then
+    PATH="${PATH}:${GOBIN}"
+    which godep &> /dev/null
+    if [ $? -ne 0 ]; then
+        echo "Installing godep..."
+        go get github.com/tools/godep || die "failed to get godep"
+    fi
+    echo "godep restore..."
+    godep restore || die "failed to set up dependencies"
     go run "$SCRIPT_DIR/src/org/apache/htrace/bundler/bundler.go" \
         --src="$SCRIPT_DIR/../web/" --dst="$SCRIPT_DIR/src/org/apache/htrace/resource/" \
             || die "bundler failed"
diff --git a/htrace-core/src/go/src/org/apache/htrace/htrace/cmd.go b/htrace-core/src/go/src/org/apache/htrace/htrace/cmd.go
index 6c26315..de5e840 100644
--- a/htrace-core/src/go/src/org/apache/htrace/htrace/cmd.go
+++ b/htrace-core/src/go/src/org/apache/htrace/htrace/cmd.go
@@ -24,7 +24,7 @@
 	"encoding/json"
 	"errors"
 	"fmt"
-	"gopkg.in/alecthomas/kingpin.v1"
+	"github.com/alecthomas/kingpin"
 	"io"
 	"io/ioutil"
 	"net/http"